bash: python: .py: command not found
bash: python: .py: command not found
To execute a Python script in this way, you need three things:
-
The file needs to have the executable bit set for you. To do this, try using:
chmod u+x validate_mapping_file.py
-
The file needs to begin with a shebang, for example
#!/usr/bin/env python3
which will tell the system to run the script using the python3 executable according to your environment -
The file needs to be in one of the directories in your
PATH
environment variable. You can add the current directory using exportPATH=$PWD:$PATH
or use./validate_mapping_file.py
instead of justvalidate_mapping_file.py
(thanks @Grisha)
Afterwards you should be able to execute the script the way you tried before.