making
making

Reputation: 1

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. 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.

Upvotes: 0

Views: 683

Answers (1)

MrNLNG_VR
MrNLNG_VR

Reputation: 26

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.

Upvotes: 0

Related Questions