简体   繁体   中英

Running Python scripts from cmd

I've installed python 3.7, but whenever I try and run a script in cmd, it says: Requested Python Version (3.7) is not installed .

Now, I start my scripts with #./usr/bin/env python3.7 , which just means that I don't have to write python3.7 in to cmd.

But, when I start my script with #!/usr/bin/env python , the script runs perfectly fine on cmd. What does this mean? Is it not running my script in Python3.7?

#!/usr/bin/env xxx looks for the first xxx to appear in $PATH .

You have python installed to the python path and likely nothing for python3.7 which means that your script is running when you have it as python and not for python3.7 because it doesn't know what to run when it can't find python3.7 in $PATH . You could probably try python3.7.4 since that is your specific version and it might work but it all depends on how it was installed and setup.

If you wanted to make python3.7 work instead, you could look here and more information on this issue here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM