Reputation:
I'm on Ubuntu and need to run a python script, but bash can't find python.
$ python main.py
bash: python: command not found
When I go to install it with apt I am told that it has already been installed.
$ 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.
How do I fix this?
Upvotes: 6
Views: 20413
Reputation: 29
Try the command which python
it will reveal the location of where your system has installed Python.
Then try adding the location revealed by which python
to PYTHONPATH
as the first answer here. It's a good place to understand this.
Upvotes: 2