I've installed django
using the pip
command (pip install Django
), but i can't run it using the py
command, as it can't find the module.
I can only make it works using 'python' command.
Here is a summary of the screenshot I have atttached
$ python --version
Python 3.6.1
$ py --version
Python 3.6.0
It also looks like django works only with 3.6.1.
Is there any way to set both commands to run newest version of python?
Screenshot:
You're using Python launcher for Windows when you executepy
. You could be specific about which Python interpreter version that you want py
to execute with this command:
> py -3.6
See this section from PEP 397: Python Version Qualifiers
If no version qualifiers are found in a command, the environment variable
PY_PYTHON
can be set to specify the default version qualifier-
the default value is "2". Note this value could specify just a major version (e.g. "2") or amajor.minor
qualifier (e.g. "2.6"), or evenmajor.minor-32
.If no minor version qualifiers are found, the environment variable
PY_PYTHON{major}
(where{major}
is the current major version qualifier as determined above) can be set to specify the full version. If no such option is found, the launcher will enumerate the installed Python versions and use the latest minor release found for the major version, which is likely, although not guaranteed, to be the most recently installed version in that family.In addition to environment variables, the same settings can be configured in the .INI file used by the launcher. The section in the INI file is called [defaults] and the key name will be the same as the environment variables without the leading
PY_ prefix
(and note that the key names in the INI file are case insensitive.) The contents of an environment variable will override things specified in the INI file.
Plus Python launcher isn't just limited to launching different Python versions, it also parses shebang #!
in source code files, providing a functionality similar to that in *nix operating systems in Windows.
*Refer to Python Launcher for Windows documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With