无法通过 glob 'Python-3.7.0' 找到任何包

无法通过 glob 'Python-3.7.0' 找到任何包

E: Couldn't find any package by glob 'Python-3.7.0'在 Ubuntu 16.04 中尝试安装 Python 3.7 时收到错误消息

ns3@ns3-virtual-machine:~$ sudo apt install Python-3.7.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done 
E: Unable to locate package Python-3.7.0
E: Couldn't find any package by glob 'Python-3.7.0'
E: Couldn't find any package by regex 'Python-3.7.0'
ns3@ns3-virtual-machine:~$ sudo apt install Python-3.7
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package Python-3.7
E: Couldn't find any package by glob 'Python-3.7'
E: Couldn't find any package by regex 'Python-3.7'
ns3@ns3-virtual-machine:~$ sudo apt install python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3 is already the newest version (3.5.1-3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ns3@ns3-virtual-machine:~$ python --version
Python 2.7.12
ns3@ns3-virtual-machine:~$ apt policy python-3.7
N: Unable to locate package python-3.7
N: Couldn't find any package by glob 'python-3.7'
N: Couldn't find any package by regex 'python-3.7
ns3@ns3-virtual-machine:~$ 

答案1

在 Ubuntu 16.04 中打开终端并输入:

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

或者您也可以使用以下命令在 Ubuntu 16.04 中安装 Python3.8:

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

类似地,您可以在 Ubuntu 18.04、20.04 和 22.04 中从 ppa:deadsnakes/ppa 安装 Python3.9。

要显示 Python 3.7 版本,请运行以下命令:

python3.7 -V

要启动 Python 3.7 解释器,请运行以下命令:

python3.7  

要退出 Python 3.x 解释器,请运行以下命令:

exit   

相关内容