[英]How to use two different Python Versions in the same File or Project?
I have written some code in cntk, which needs Python Version 3.6 or older.我在cntk中写了一些代码,需要Python 3.6或更早的版本。 The problem is that I want to use this code in a Project, which only allows Python 3.8 or newer.问题是我想在项目中使用此代码,它只允许 Python 3.8 或更新版本。 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.编辑:3.6 代码做了一些深度学习预测,应该从 3.8 项目中调用它们以将它们用于其他计算。
On Windows they get installed to separate folders, "C:\python26" and "C:\python31", but the executables have the same "python.exe" name.在 Windows 上,它们被安装到单独的文件夹“C:\python26”和“C:\python31”,但可执行文件具有相同的“python.exe”名称。
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.我创建了另一个“C:\python”文件夹,其中包含“python.bat”和“python3.bat”,分别作为“python26”和“python31”的包装器,并将“C:\python”添加到 PATH 环境变量.
This allows me to type python or python3 in my.bat Python wrappers to start the one I desire.这允许我在 my.bat Python 包装器中键入 python 或 python3 以启动我想要的包装器。
On Linux, you can use the #.在 Linux 上,您可以使用#。 trick to specify which version you want a script to use.指定您希望脚本使用哪个版本的技巧。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.