سؤال

I'd like to know if installing specific version of Python more than once on Windows is possible.
I'm asking about normal installation procedure leading to full Python environment so virtualenv is not an option here.
I'm concerned for example with registry key HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/<Version> which may be used during installation of other libraries/programs to find out Python's installation folder.

Background:
I'd like to test difference between installing PySide normally and from within virtualenv. I don't want to use my working Python installation for this so I need clean Python installation for duration of my test to coexist side by side with existing one.

هل كانت مفيدة؟

المحلول

I use multiple registry files (*.reg) to switch between multiple Python interpreters of the same version but installed in different locations. Adjust version number and location in this template:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\X.Y]

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\X.Y\Help]
@=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\X.Y\Help\Main Python Documentation]
@="C:\\PythonXY\\Doc\\pythonXYZ.chm"

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\X.Y\InstallPath]
@="C:\\PythonXY\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\X.Y\InstallPath\InstallGroup]
@="Python X.Y"

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\X.Y\Modules]

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\X.Y\PythonPath]
@="C:\\PythonXY\\Lib;C:\\PythonXY\\DLLs"

نصائح أخرى

You can install several Python versions on Windows; I did this and did not notice any adverse effects.

When you install a package, you just run the version of interpreter to which you want to install the package, that is, python31 setup.py install or such. The interpreter knows where its home is.

Also, consider using virtualenv if you have to handle multiple Python or packages versions. This way you'll have as many different 'installations' of Python and/or packages as you want, without touching system-wide stuff.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top