206k views
5 votes
-bash: python: command not found i used python myfile.py but it just gives me this -bash: python: command not found how do i fix that?

User Yenta
by
8.3k points

1 Answer

0 votes

One solution to fix the "-bash: python: command not found" error is to use "python3" instead of "python" to run your Python script. The issue may arise if your system uses Python 3 as the default version, and "python" is not recognized as a command.

Try running your Python script using the following command:

python3 myfile.py

Using "python3" ensures that the system uses the correct Python interpreter, which is often associated with Python 3 installations. This should resolve the issue and allow you to execute your Python script successfully.

I hope this helped!

~~~Harsha~~~

User BeS
by
8.5k points

No related questions found