You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 20.04新手执行命令报错Command 'python' not found求助

Ubuntu 20.04 提示Command 'python' not found 解决方案

问题原因

Ubuntu 20.04及更高版本默认不再预装Python 2,同时系统默认没有将python命令关联到Python 3版本,因此直接执行python命令会触发如下报错:

Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3

解决方法

方案1:临时替换使用

不需要修改系统配置,每次执行Python相关命令时,直接用python3替换python即可,示例:
python3 test.py

方案2:永久绑定python命令指向Python3

如果需要沿用之前的使用习惯,直接用python调用Python 3,可以安装官方提供的绑定包:

  • 第一步:更新软件源缓存
    sudo apt update
  • 第二步:安装python-is-python3包
    sudo apt install -y python-is-python3

安装完成后执行python --version验证,正常会返回系统安装的Python 3版本号,说明配置生效。

内容的提问来源于stack exchange,提问作者Saksham Shukla

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.30 23:48:03