Ubuntu:Python命令未找到,但apt显示它';它已经安装好了

Ubuntu:Python命令未找到,但apt显示它';它已经安装好了,python,ubuntu,Python,Ubuntu,我在Ubuntu上,需要运行python脚本,但bash找不到python $ python main.py bash: python: command not found 当我用apt安装它时,我被告知它已经安装好了 $ sudo apt-get install python Reading package lists... Done Building dependency tree Reading state information... Done python is alr

我在Ubuntu上,需要运行python脚本,但bash找不到python

$ python main.py
bash: python: command not found
当我用apt安装它时,我被告知它已经安装好了

$ sudo apt-get install python
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python is already the newest version (2.7.12-1~16.04).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

如何修复此问题?

尝试使用命令
它将显示系统安装python的位置


然后尝试将
whichpython
显示的位置添加到
PYTHONPATH
作为第一个答案。这是一个了解这一点的好地方

它被保存为python3而不是python

哪个python
的输出是什么?@ChrisHunt当我键入“$which python”时,它不输出任何东西anything@TylerHilbert如果
哪个python
不输出任何内容,并且如果
python
导致解释器,那么python很可能不会添加到路径中。仍然按照链接中的说明操作。