python3
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
python3 [2017/02/01 16:23] – dblume | python3 [2023/04/14 20:37] (current) – dblume | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Python3 ====== | ====== Python3 ====== | ||
- | If I want Python 3.6, I have to compile it myself. | + | If I want Python 3.7, I have to compile it myself. |
+ | |||
+ | ===== RedHat based distros ===== | ||
<code bash> | <code bash> | ||
Line 9: | Line 11: | ||
</ | </ | ||
- | I haven' | + | Then on Fedora and CentOS... |
<code bash> | <code bash> | ||
- | sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev | + | wget https:// |
+ | tar -xvf Python-3.7.0.tgz | ||
+ | cd Python-3.7.0/ | ||
+ | ./ | ||
+ | make | ||
+ | sudo make install | ||
+ | # sudo ln -s / | ||
</ | </ | ||
- | Then... | + | On my dev system at work, I seem to have configured a prefix like / |
+ | |||
+ | sudo rm / | ||
+ | |||
+ | For **OS X**, brew upgrading httpie seems to upgrade to the latest Python 3, so I didn't have to do stuff. | ||
+ | |||
+ | ===== Debian based distros (Start) ===== | ||
+ | |||
+ | For Debian (eg., Rasbian) try [[http:// | ||
<code bash> | <code bash> | ||
- | wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz | + | sudo apt-get install build-essential libncursesw5-dev libreadline-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev libffi-dev |
- | tar -xvf Python-3.6.0.tgz | + | </code> |
- | cd Python-3.6.0/ | + | |
- | ./configure | + | ==== (Aside) OpenSSL 1.0.1 issue in Raspbian ==== |
+ | |||
+ | On Raspbian Jessie the make command (below) may have output that looks like this: | ||
+ | |||
+ | < | ||
+ | The necessary bits to build these optional modules were not found: | ||
+ | _bz2 _lzma | ||
+ | </code> | ||
+ | |||
+ | On Raspbian, the pip module may not work because it relies on the ssl module. | ||
+ | |||
+ | < | ||
+ | pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. | ||
+ | </code> | ||
+ | |||
+ | Python' | ||
+ | |||
+ | > Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host(). | ||
+ | |||
+ | If you check the version of ssh: | ||
+ | |||
+ | < | ||
+ | $ openssl version | ||
+ | OpenSSL 1.0.1t | ||
+ | </ | ||
+ | |||
+ | That OpenSSL is too old. So you may have to [[https:// | ||
+ | |||
+ | <code bash> | ||
+ | # Add the backport apt source. | ||
+ | echo "deb-src http:// | ||
+ | sudo tee / | ||
+ | sudo apt update | ||
+ | |||
+ | # Get the openssl source | ||
+ | apt-get source openssl/ | ||
+ | |||
+ | # Make and install it. | ||
+ | cd openssl-1.0.2k/ | ||
+ | ./config | ||
make | make | ||
+ | make test | ||
sudo make install | sudo make install | ||
- | # sudo ln -s /opt/python3/bin/python3 /usr/bin/python3 | + | </ |
+ | |||
+ | **Update**: The following apt-cache policy command showed the old libssl was still installed. It's probably bad, but I [[https://my-take-on.tk/ | ||
+ | |||
+ | < | ||
+ | sudo apt-cache policy libssl-dev | ||
+ | </ | ||
+ | |||
+ | ===== Debian based distros (Continued) ===== | ||
+ | |||
+ | Then, back to Python3, on Raspbian, I put it in the default location, / | ||
+ | |||
+ | <code bash> | ||
+ | screen | ||
+ | cd Python-3.7.0/ | ||
+ | ./configure --enable-optimizations | ||
+ | make -j4 | ||
+ | sudo make install | ||
+ | [[ $TERM != " | ||
+ | </ | ||
+ | |||
+ | ===== Modules ===== | ||
+ | |||
+ | Sometimes I have trouble with pip3 (ImportError: | ||
+ | |||
+ | <code bash> | ||
+ | sudo -H python3 -m pip install --upgrade pip | ||
+ | sudo -H python3 -m pip install requests | ||
+ | sudo -H python3 -m pip install numpy | ||
+ | sudo -H python3 -m pip install matplotlib | ||
+ | python3 -m pip install --user --upgrade httpie | ||
+ | </code> | ||
+ | |||
+ | ===== Weird hack for impyla ===== | ||
+ | |||
+ | Refers to https:// | ||
+ | |||
+ | <code bash> | ||
+ | sudo python3 | ||
+ | sudo python3 -m pip install --no-deps git+https://github.com/snowch/ | ||
+ | # sudo python3 | ||
+ | </ | ||
+ | |||
+ | ===== MatPlotLib ===== | ||
+ | |||
+ | There' | ||
+ | |||
+ | <code python> | ||
+ | import matplotlib | ||
+ | matplotlib.use(' | ||
</ | </ |
python3.1485994990.txt.gz · Last modified: 2023/04/12 20:44 (external edit)