Python Ubutun更新到 3.5
查看系统中python所在的路径
whereis python
eg:
- cd 到/usr/bin目录下将python备份为python.bak(
mv python python.bak
) - 更改软链接到python3.5 (
sudo ln -s /usr/bin/python3.5 /usr/bin/python
) -->此时系统python环境为3.5 - 安装pip
-sudo apt-get update
-sudo apt-get install python3-pip
(此时的pip仍是2.7版本的pip,若要安装需使用pip3) - 为使用pip安装 (
pip3 install --upgrade pip
)
更新到3.8
- 下载python3.8资源包
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0a2.tgz
- 解压资源包
tar -xvzf Python-3.8.0a2.tgz
- 配置资源
./configure --prefix=/usr/local/python3
(--prefix配置路径) - 编译
make
- 会提示缺少模块,依次安装
-sudo apt-get update
-sudo apt-get upgrade
-sudo apt-get dist-upgrade
-sudo apt-get install libbz2-dev libncurses5-dev libgdbm-dev libgdbm-compat-dev liblzma-dev libsqlite3-dev libssl-dev openssl tk-dev uuid-dev libreadline-dev
- 再次配置编译,重复3.4步骤
- 安装(
sudo make install
) - 配置链接路径(
sudo update-alternatives --install /usr/bin/python python /usr/local/python3/bin/python3 1
)
sudo update-alternatives --config pip
- 配置pip软链接(
sudo update-alternatives --install /usr/bin/pip pip /usr/local/python3/bin/pip3 1
)
sudo update-alternatives --config pip
更新3.8 version参考博客链接:https://blog.csdn.net/liuenming123/article/details/88638626
网友评论