尝试验证 python 版本未指示安装的 python 版本(如果有):
ubuntu@ubuntu:~$ python -V
The program 'python' can be found in the following packages:
* python-minimal
* python3
Try: sudo apt install <selected package>
ubuntu@ubuntu:~$ python --version
The program 'python' can be found in the following packages:
* python-minimal
* python3
Try: sudo apt install <selected package>
Ubuntu 不是默认安装 python 吗?
更新:感谢 Dobey
ubuntu@ubuntu:/$ cd /usr/bin
ubuntu@ubuntu:/usr/bin$ find . | grep python
./python3-jsondiff
./python3.5m
./python3-jsonpointer
./python3-jsonpatch
./python3.5
./python3m
./python3
./dh_python3
ubuntu@ubuntu:/usr/bin$ which python3
/usr/bin/python3
ubuntu@ubuntu:/usr/bin$ cd /
ubuntu@ubuntu:/$ which python3
/usr/bin/python3
ubuntu@ubuntu:/$ python3 -V
Python 3.5.1+
ubuntu@ubuntu:/$
答案1
该程序/usr/bin/python
是 Python 2.x,默认情况下未安装。您需要使用python3
。