Reputation: 289
I try to run python3 from a symbolic link on Windows, but it doesn't work!
I have multiple versions of Python installed on my computer, e.g. Python 2.7 and Python 3.6 and 3.6 64bit. They are installed in G:\Developer\Python\2.7
and so on.
I use symbolic links to run specific a python version. In G:\Developer\Python
are symbolic links python2.exe, python3.exe, python36x64.exe and so on.
To create those symbolic links, I use Link Shell Extension.
Running the original python.exe inside the installation path (e.g. G:\Developer\Python\3.6\python.exe) does work without any problems. The symlinks targeting python2 work as expected, too, but the python3 links doesn't work. In a Powershell-terminal, they do nothing at all (no error message, no output). In a windows commandline window, trying to start them give me this error message (translation below):
The code could not execute, because python36.dll hasn't been found. Reinstallation will probably solve the problem.
So I'm not sure how I should install multiple python version side by side?
Thanks in advance! Micha
Upvotes: 1
Views: 4138
Reputation: 149115
Things are worse (or better) than that on Windows. In a traditional Windows installation, the Python executable uses either the registry, the environment or the directory of the executable to locate its installation path. That means that a symbolic link will break that search..
But the standard way to deal with multiple installations on Windows is the py.exe
launcher that comes with Python > 3.3 . If you installed for all users or at least asked the installer to install launcher for all users (recommended), it will be available in default path (my 3.6 version installed it in the Windows directory).
Now without more configuration, you can start Python 2.7 with py -2.7
, and Python 3.6 with py -3.6
if you do not pass a version option,
the launcher will correctly select the most appropriate version of Python. It will prefer per-user installations over system-wide ones, and orders by language version rather than using the most recently installed version
...
If you want the latest version of Python 2.x you have installed, try the command:
py -2
I currently have not a 32 and 64 bits version side by side so I could not test it, but further configuration is possible through a PY.INI
file
reference doc for Python launcher
Upvotes: 1