如何在同一个文件或项目中使用两个不同的Python版本?
我在cntk中编写了一些代码,需要Python版本3.6或更早版本。问题是我想在项目中使用此代码,该项目仅允许 Python 3.8 或更高版本。结合这两个程序的最佳解决方案是什么?
编辑: 3.6 代码做了一些深度学习预测,应该从 3.8 项目中调用它们以将它们用于其他计算。
I have written some code in cntk, which needs Python Version 3.6 or older. The problem is that I want to use this code in a Project, which only allows Python 3.8 or newer. What's the best solution to combine these two programms?
EDIT:
The 3.6 code does some deep learning predictions, which should be called from the 3.8 project to use them for other computations.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Windows 上,它们安装到单独的文件夹“C:\python26”和“C:\python31”,但可执行文件具有相同的“python.exe”名称。
我创建了另一个“C:\python”文件夹,其中包含“python.bat”和“python3.bat”,分别用作“python26”和“python31”的包装器,并将“C:\python”添加到 PATH 环境变量。
这允许我在 .bat Python 包装器中输入 python 或 python3 来启动我想要的包装器。
在 Linux 上,您可以使用 #!指定您希望脚本使用哪个版本的技巧。
On Windows they get installed to separate folders, "C:\python26" and "C:\python31", but the executables have the same "python.exe" name.
I created another "C:\python" folder that contains "python.bat" and "python3.bat" that serve as wrappers to "python26" and "python31" respectively, and added "C:\python" to the PATH environment variable.
This allows me to type python or python3 in my .bat Python wrappers to start the one I desire.
On Linux, you can use the #! trick to specify which version you want a script to use.