要检查Ubuntu上是否安装了Python,您可以打开终端(快捷键:Ctrl + Alt + T),然后输入以下命令:
python --version
或者
python3 --version
如果Python已安装,您将看到类似以下的输出,显示Python的版本号:
Python 3.8.5
如果没有安装Python,您将看到一个错误消息,类似于:
python: can't open file '/usr/bin/python': [Errno 2] No such file or directory
或者
python3: can't open file '/usr/bin/python3': [Errno 2] No such file or directory
在这种情况下,您需要安装Python。对于大多数Ubuntu版本,Python 3是默认安装的。如果您需要安装Python 2,可以使用以下命令:
sudo apt-get update
sudo apt-get install python2
请注意,Python 2已经在2020年1月1日停止支持,因此建议您使用Python 3。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: filezilla连接ubuntu时断开怎么办