安装了 Python 2.7 但没有 CLI 解释器?

安装了 Python 2.7 但没有 CLI 解释器?

我刚刚让我的服务器提供商在一台新服务器上安装了 Ubuntu 15.1.0。我需要在服务器上运行 Python 2.7.11 来部署我想要部署的应用程序。我运行后apt --installed list发现我安装了许多 Python 包:

dh-python/wily,wily,now 2.20150826ubuntu1 all [installed]
libpython2.7/wily,wily,now 2.7.10-4ubuntu1 amd64 [installed,automatic]
libpython2.7-minimal/wily,wily,now 2.7.10-4ubuntu1 amd64 [installed,automatic]
libpython2.7-stdlib/wily,wily,now 2.7.10-4ubuntu1 amd64 [installed,automatic]
libpython3-stdlib/wily,wily,now 3.4.3-4ubuntu1 amd64 [installed]
libpython3.4-minimal/wily,wily,now 3.4.3-9ubuntu1 amd64 [installed]
libpython3.4-stdlib/wily,wily,now 3.4.3-9ubuntu1 amd64 [installed]
python-apt-common/wily-updates,wily-updates,now 1.0.1ubuntu0.1 all [installed]
python3/wily,wily,now 3.4.3-4ubuntu1 amd64 [installed]
python3-apt/wily-updates,wily-updates,now 1.0.1ubuntu0.1 amd64 [installed]
python3-dbus/wily,wily,now 1.2.0-2build3 amd64 [installed]
python3-distupgrade/wily-updates,wily-updates,now 1:15.10.14.4 all [installed]
python3-gdbm/wily,wily,now 3.4.3-4 amd64 [installed]
python3-gi/wily,wily,now 3.16.2-1build1 amd64 [installed]
python3-minimal/wily,wily,now 3.4.3-4ubuntu1 amd64 [installed]
python3-six/wily,wily,now 1.9.0-5 all [installed]
python3-update-manager/wily,wily,now 1:15.10.3 all [installed]
python3.4/wily,wily,now 3.4.3-9ubuntu1 amd64 [installed]
python3.4-minimal/wily,wily,now 3.4.3-9ubuntu1 amd64 [installed]

我不确定其中大部分是什么。现在,我的问题是我想python在命令行上使用 Python 2.7.x。现在,python指代什么都没有(-bash: python: command not found)。python2和 也是一样python2.7。但是,根据上面的列表,似乎确实安装了 Python 2.7.x。

python3运行正常,但启动的是 Python 3.4.x,而我需要 2.7.x

编辑:作为参考,whereis python返回:

python: /usr/bin/python3.4 /usr/bin/python3.4m /usr/lib/python3.4 /usr/lib/python3.5 /usr/lib/python2.7 /etc/python3.4 /etc/python2.7 /usr/local/lib/python3.4

答案1

您有 Python 2.7 库的软件包,但没有解释器的软件包。安装软件包python时应将其作为依赖项安装python2.7,其中包含 Python 2.7 的解释器。

相关内容