This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
python3 [2018/07/30 11:57] 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 ===== | ===== RedHat based distros ===== | ||
| Line 11: | Line 11: | ||
| </ | </ | ||
| - | Then on Fedora and macOS... | + | Then on Fedora and CentOS... |
| <code bash> | <code bash> | ||
| Line 17: | Line 17: | ||
| tar -xvf Python-3.7.0.tgz | tar -xvf Python-3.7.0.tgz | ||
| cd Python-3.7.0/ | cd Python-3.7.0/ | ||
| - | ./configure --prefix=/opt/python3 --enable-optimizations | + | ./configure --prefix=/usr/ |
| make | make | ||
| sudo make install | sudo make install | ||
| - | # sudo ln -s /opt/ | + | # sudo ln -s /usr/ |
| </ | </ | ||
| - | ===== Debian based distros ===== | + | 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 | ||
| For Debian (eg., Rasbian) try [[http:// | For Debian (eg., Rasbian) try [[http:// | ||
| Line 30: | Line 36: | ||
| sudo apt-get install build-essential libncursesw5-dev libreadline-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev libffi-dev | 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: | ||
| < | < | ||
| Line 36: | Line 46: | ||
| </ | </ | ||
| - | On Raspbian, | + | On Raspbian, |
| + | |||
| + | < | ||
| + | pip is configured with locations that require TLS/SSL, however the ssl module | ||
| + | </ | ||
| + | |||
| + | 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> | <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, /usr/local: | ||
| + | |||
| + | <code bash> | ||
| + | screen | ||
| cd Python-3.7.0/ | cd Python-3.7.0/ | ||
| ./configure --enable-optimizations | ./configure --enable-optimizations | ||
| make -j4 | make -j4 | ||
| sudo make install | sudo make install | ||
| + | [[ $TERM != " | ||
| </ | </ | ||
| ===== Modules ===== | ===== Modules ===== | ||
| - | Sometimes I have trouble with pip3 (ImportError: | + | 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> | <code bash> | ||
| - | sudo python3 -m pip install --upgrade | + | sudo python3 -m pip install --no-deps impyla |
| - | sudo python3 -m pip install | + | sudo python3 -m pip install --no-deps git+https:// |
| + | # sudo python3 -m pip install | ||
| </ | </ | ||