gpt4 book ai didi

python-3.x - 在 Ubuntu/Vagrant 上升级 Python3

转载 作者:行者123 更新时间:2023-12-04 18:37:37 25 4
gpt4 key购买 nike

如何在 Ubuntu 上升级我的 python3 安装?特别是从 3.5.2 --> 3.6.x

这是基本的尝试,虽然我也尝试过removepurge没有明显效果的命令。

Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-130-generic x86_64)
$ ubuntu@ubuntu-xenial:/vagrant$ python3 --version
Python 3.5.2
$ sudo apt-get install python3 3.6 --reinstall
... [no errors, lots of output]
$ ubuntu@ubuntu-xenial:/vagrant$ python3 --version
Python 3.5.2

在这一点上,我希望看到 Python 3.6.x 作为版本。我在 /usr/bin 中没有看到任何新条目
ubuntu@ubuntu-xenial:/vagrant$ ll /usr/bin | grep python
lrwxrwxrwx 1 root root 26 May 18 2016 dh_pypy -> ../share/dh-python/dh_pypy*
-rwxr-xr-x 1 root root 1056 Nov 24 2017 dh_python2*
lrwxrwxrwx 1 root root 29 May 18 2016 dh_python3 -> ../share/dh-python/dh_python3*
lrwxrwxrwx 1 root root 23 Dec 4 2017 pdb2.7 -> ../lib/python2.7/pdb.py*
lrwxrwxrwx 1 root root 23 Nov 28 2017 pdb3.5 -> ../lib/python3.5/pdb.py*
lrwxrwxrwx 1 root root 31 Mar 23 2016 py3versions -> ../share/python3/py3versions.py*
lrwxrwxrwx 1 root root 26 May 18 2016 pybuild -> ../share/dh-python/pybuild*
lrwxrwxrwx 1 root root 9 Nov 24 2017 python -> python2.7*
lrwxrwxrwx 1 root root 9 Nov 24 2017 python2 -> python2.7*
-rwxr-xr-x 1 root root 3492656 Dec 4 2017 python2.7*
lrwxrwxrwx 1 root root 9 Mar 23 2016 python3 -> python3.5*
-rwxr-xr-x 2 root root 4464400 Nov 28 2017 python3.5*
-rwxr-xr-x 2 root root 4464400 Nov 28 2017 python3.5m*
lrwxrwxrwx 1 root root 10 Mar 23 2016 python3m -> python3.5m*
lrwxrwxrwx 1 root root 29 Nov 24 2017 pyversions -> ../share/python/pyversions.py*

没有直接证据表明安装了任何新设备
ubuntu@ubuntu-xenial:/vagrant$ py3versions -i
python3.5

我想要的只是在这个虚拟机上安装 python3 >= 3.6。我根本不关心以前的安装、python2、virtualenvs 或任何一般的服务器健康事物,因为这是一个完全独立的开发框。

最佳答案

对于 Ubuntu 16.04,您可以使用 Felix Krull's deadsnakes PPA

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6

或者,您可以使用 J Fernyhough's PPA
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

如果你想在 Ubuntu 16.04 上编译安装 python 3.6
sudo apt install build-essential checkinstall
sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
tar xvf Python-3.6.0.tar.xz
cd Python-3.6.0/
./configure
sudo make altinstall

关于python-3.x - 在 Ubuntu/Vagrant 上升级 Python3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52028885/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com