I am using linux mint, and to run a python file I have to type in the terminal: python [file path]
, so is there way to make the file executable, and make it run
I suggest that you add
#!/usr/bin/env python
instead of #!/usr/bin/python
at the top of the file. The reason for this is that the python installation may be in different folders in different distros or different computers. By using env
you make sure that the system finds python and delegates the script's execution to it.
As said before to make the script executable, something like:
chmod u+x name_of_script.py
should do.