下載python
網址:https://mirrors.huaweicloud.com/python/
這裏以安裝python3.7.1爲例:
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
編譯和安裝python
prefix是指定python安裝的位置
cd Python-3.7.1
./configure --prefix=/home/work/envs/python3.7.1 && make && make install
設置軟連接
ln -s /home/work/envs/python3.7.1/bin/python3 /usr/bin/python3.7.1
ln -s /home/work/envs/python3.7.1/bin/pip3 /usr/bin/pip3.7.1