Allen0 2019-07-01
中间可能有多余空格,去除下再运行,一般都能安装成功,如果不能可以先更新下sudo apt-get update
sudo apt-get install zlib1g-dev libbz2-dev libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libpcap-dev xz-utils libexpat1-dev liblzma-dev libffi-dev libc6-dev
jianjiacheng@J-computer:~$ tar zxvf Python-3.7.1
jianjiacheng@J-computer:~$ cd Python-3.7.1/
sudo mkdir -p /usr/local/python3
执行这步是后面最好加上 --enable-optimizations 会自动安装pip3及优化配置
# ./configure --prefix=/usr/local/python3 --enable-optimizations # make # sudo make install
先执行查看版本,如果有则证明软链接已存在,需要先删去以前的再重新建立
//这里表明我已有python3的软链接而没有pip3的软链接所以需要删除python3的软链接重新建立 jianjiacheng@J-computer:~/Python-3.7.1$ python3 -V Python 3.5.2 jianjiacheng@J-computer:~$ pip3 -V bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: No such file or directory
rm -rf /usr/bin/python3 rm -rf /usr/bin/pip3
#添加python3的软链接 ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3 #添加 pip3 的软链接 ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
jianjiacheng@J-computer:~$ python3 -V Python 3.7.1 jianjiacheng@J-computer:~$ pip3 -V pip 10.0.1 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)