script.py is simply printing the Python version used, but with shebang version specified.
#!/usr/bin/python3.1
import platform
print(platform.python_version())
So, the results are following.1. Starting the script from command line python test.py will give us the default version2. Starting the script from command line with specified the version python3.1 test.py will give us the 3.1 python version.3. If we remove the shebang line, so the script will behave absolutely the same, but
./test.py will fail, when launching with shebang line ./test.py - it will give us the correct 3.1 version. Launching without shebang line this way python3.1 test.py also will give us the 3.0 version.
No comments:
Post a Comment