我想在我的 ubuntu 中使用 python。当我使用 python 命令时它告诉我:
dc2-user@10-254-6-144:~$ python
The program 'python' can be found in the following packages:
* python-minimal
* python3
Ask your administrator to install one of them
然后我尝试安装它:
dc2-user@10-254-6-144:~$ sudo apt-get 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.
但是如你所见,我好像已经安装了python3.5 然后我卸载它并安装它,通过
sudo apt-get remove python3.5
sudo apt-get install python3.5
但仍然无法使用 python 命令。
一般来说,安装后我可以使用python命令。我不知道发生了什么以及下一步应该做什么?
最佳答案
Ubuntu 仅安装 Python 3,并且不会添加从 /usr/bin/python3
到 /usr/bin/python
的链接
所以你被迫:
- 使用
python3
或
- 自行添加链接、别名或其他基于 shell 的解决方案
引用:
引用:
- Python 3 will be the only Python version installed by default.
- Python 3 will be the only Python version in any installation media (i.e. image ISOs)
- Only Python 3 will be allowed on the Ubuntu touch images.
- All upstream libraries that support Python 3 will have their Python 3 version available in the archive.
- All applications that run under Python 3 will use Python 3 by default.
- All system scripts in the archive will use Python 3.
和
- /usr/bin/python will point to Python 3. No, this is not going to happen (unless PEP 394 advocates otherwise, which is doubtful for the foreseeable future). /usr/bin/python and /usr/bin/python2 will point to Python 2.7 and /usr/bin/python3 will point to the latest supported Python 3 version.
关于python - 为什么我不能使用 python,尽管它告诉我 python3 已经是最新版本(3.5.1-3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47882307/