我正在尝试在我的 Ubuntu 18.04 服务器上安装Python 3.7 。遵循这些指示:
https://phoenixnap.com/kb/how-to-install-python-3-ubuntu
sudo apt update
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7
但在那之后,如果我这样做:
root@west:~# python --version
Python 2.7.17
我究竟做错了什么?如果我尝试再次安装它,它会告诉我它已经安装了?
root@west:~# sudo apt install python3.7
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3.7 is already the newest version (3.7.7-1+bionic1).
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.
两者都已安装,但有一个指向 python2.7 的链接。
如果你这样做
ls -l /usr/bin/python
,它将指向 python2.7,如下所示:删除链接并创建一个新链接
python3.7