我正在尝试在 Ubuntu 16.04 上安装 Python 2.7。当我尝试python
或python2
或 时python2.7
,我收到以下消息:
The program 'python' can be found in the following packages:
* python-minimal
* python3
Try: sudo apt install <selected package>
运行后sudo apt install python2.7
,我收到以下消息,但是当我输入时 python 仍然不可用python
。
Reading package lists... Done Building dependency tree Reading state
information... Done You might want to run 'apt-get -f install' to
correct these: The following packages have unmet dependencies:
mongodb-compass : Depends: gvfs-bin
Depends: python but it is not going to be installed
python2.7 : Depends: python2.7-minimal (= 2.7.12-1ubuntu0~16.04.3) but
it is not going to be installed
Depends: libpython2.7-stdlib (= 2.7.12-1ubuntu0~16.04.3) but
it is not going to be installed
E: Unmet dependencies.
Try 'apt-get -f install' with no packages (or specify a solution).
我也尝试过:
sudo apt install python
sudo apt install python2.7
sudo apt install python2
sudo apt-get install python
sudo apt-get install python 2.7
sudo apt-get install python2
到现在为止什么都没有起作用。
我只需输入 即可访问 Python3.5 python3
,但我需要 python2.7。我在尝试安装 python 之前更新了存储库。我做错了什么?
更新
运行python的缓存策略:
python2.7:
Installed: (none)
Candidate: 2.7.12-1ubuntu0~16.04.3
Version table:
2.7.12-1ubuntu0~16.04.3 500
500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
2.7.12-1ubuntu0~16.04.2 500
500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
2.7.11-7ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
运行mongodb的缓存策略:
mongodb-compass:
Installed: 1.6.0-1
Candidate: 1.6.0-1
Version table:
*** 1.6.0-1 100
100 /var/lib/dpkg/status
答案1
尝试mongodb-compass
删除
sudo apt-get purge mongodb-compass
然后检查一切是否到位
sudo apt-get install -f
sudo apt-get check
答案2
尝试这个简单的命令并安装 python 2.7,谢谢
sudo apt 安装 python-minimal
并检查版本,您将获得 2.7.X 版本 (python -V)