[英]how to run code in different python versions
I have two python scripts and one of them runs on python 3.8.6 64bit and the other runs on python 3.8.6 32bit version.我有两个 python 脚本,其中一个运行在 python 3.8.6 64 位版本上,另一个运行在 python 3.8.6 32 位版本上。 I have been trying to run them using different python version using shebang but it does not seem to work.
我一直在尝试使用 shebang 使用不同的 python 版本运行它们,但它似乎不起作用。
I'm currently using Visual Studio Code and even though I put shebang code like this #:"C./Python/3.8.6/64/python.exe"我目前正在使用 Visual Studio Code,即使我像这样放置 shebang 代码 #:"C./Python/3.8.6/64/python.exe"
it does not change the python version the script is running Is there a way to make python code to run at specific version?它不会更改脚本正在运行的 python 版本有没有办法让 python 代码在特定版本上运行?
If you're using visual studio code, use ctrl + shift + p
and choose specific interpreter for your code to run.如果您使用的是 Visual Studio 代码,请使用
ctrl + shift + p
并为要运行的代码选择特定的解释器。
Other option is to make a virtualenv with the python version you need and run it your code there.另一种选择是使用您需要的 python 版本创建一个 virtualenv,并在那里运行您的代码。
Press CTRL + SHIFT + P and search for open user settings In there search for this setting: Python: python interpreter Then you can change the path of your python interpreter按 CTRL + SHIFT + P 并搜索打开的用户设置 在那里搜索此设置: Python: python 解释器 然后您可以更改 python 解释器的路径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.