ubuntu升级python_如何在Ubuntu环境中安装升级python版本

如何在Ubuntu环境中安装升级python版本

发布时间:2020-06-05 14:54:05

来源:亿速云

阅读:258

这篇文章主要介绍了在Ubuntu环境中安装升级python版本的方法,具有一定借鉴价值,需要的朋友可以参考下。如下资料是关于python版的详细步骤内容。

1. 下载python3.6源码包wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz

2. 解压并开始安装tar -xvf Python-3.6.5.tgz

cd Python-3.6.5/

./configure

make && make install

3. 替换python3为python3.6update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1

update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.6 2

update-alternatives --config python3

4. 解决pip3安装问题

替换版本之后 pip3 install 时会提示错误subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1., 重点关注lsb_release.py这个模块

我们将python3.5中的lsb_release.py复制到python3.6中root@ubuntu:~# find / -name 'lsb_release.py'

/usr/lib/python2.7/dist-packages/lsb_release.py

/usr/lib/python3/dist-packages/lsb_release.py

/usr/share/pyshared/lsb_release.py

root@ubuntu:~# cp /usr/lib/python3/dist-packages/lsb_release.py /usr/local/lib/python3.6/

看完这篇文章,你们学会在Ubuntu环境中安装升级python版本的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值