This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
python3 [2017/02/01 16:20] dblume |
python3 [2021/05/21 00:04] (current) |
||
|---|---|---|---|
| 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: | ||
| </ | </ | ||
| - | Then... | + | Then on Fedora and CentOS... |
| <code bash> | <code bash> | ||
| - | wget https:// | + | wget https:// |
| - | tar -xvf Python-3.6.0.tgz | + | tar -xvf Python-3.7.0.tgz |
| - | cd Python-3.6.0/ | + | cd Python-3.7.0/ |
| - | ./configure --prefix=/opt/python3 | + | ./configure --prefix=/usr/ |
| make | make | ||
| sudo make install | sudo make install | ||
| - | # sudo ln -s / | + | # sudo ln -s / |
| + | </ | ||
| + | |||
| + | 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> | ||
| + | sudo apt-get install build-essential libncursesw5-dev libreadline-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev libffi-dev | ||
| + | </ | ||
| + | |||
| + | ==== (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 | ||
| + | </ | ||
| + | |||
| + | 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. | ||
| + | </ | ||
| + | |||
| + | 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 " | ||
| + | sudo tee / | ||
| + | sudo apt update | ||
| + | |||
| + | # Get the openssl source | ||
| + | apt-get source openssl/ | ||
| + | |||
| + | # Make and install it. | ||
| + | cd openssl-1.0.2k/ | ||
| + | ./config --prefix=/ | ||
| + | make | ||
| + | make test | ||
| + | sudo make install | ||
| + | </ | ||
| + | |||
| + | **Update**: The following apt-cache policy command showed the old libssl was still installed. It's probably bad, but I [[https:// | ||
| + | |||
| + | < | ||
| + | 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 | ||
| + | </ | ||
| + | |||
| + | ===== Weird hack for impyla ===== | ||
| + | |||
| + | Refers to https:// | ||
| + | |||
| + | <code bash> | ||
| + | sudo python3 -m pip install --no-deps impyla | ||
| + | sudo python3 -m pip install --no-deps git+https:// | ||
| + | # sudo python3 -m pip install thriftpy | ||
| </ | </ | ||