re: Dead Simple Python: Virtual Environments and pip VIEW POST

FULL DISCUSSION
 

Hello Jason,
I found this article very informative and point-to-point coverage on topics.
Though I still have doubts on she-bang. As you said above if we write !#/usr/bin/env as first line in python script we don't need to call it with 'python' command on terminal. So I tried this by writing 'test.py' on Linux but this script is not getting executed without typing 'python' onto the beginning of the terminal command and it gives error : 'test.py' is not a command..
So I didn't understand the use of she-bang properly.
Are there any exceptions to these?

 

That error has nothing to do with Python at all. Running just...

test.py

...is going to search your system environment paths for an executable file called test.py, and I can practically guarantee your project folder isn't part of that environment path.

Thus, you need to run...

./test.py

The . means "current working directory", and then you build the relative path from there.

code of conduct - report abuse