6

There are many versions of Python, and it becomes difficult to manage them all.

Often I need to install one module into 3 different versions of Python.

Is there a tool which can simplify things?

I'm on Windows.

Thanks.

utapyngo
  • 6,946
  • 3
  • 44
  • 65
  • 1
    3 different python versions? sounds like some old applications should rather be fixed to work with a recent version. Usually you shouldn't need more than python 2.6 or better 2.7 and python 3.x. – ThiefMaster Aug 20 '11 at 08:24
  • @Thiefmaster there are still lots of legacy applications that require 2.4 or 2.5. If you're dealing with them, however, I don't see why you'd need Python 3... – agf Aug 20 '11 at 09:50
  • Of course.. python 3 is not necessary unless you need it. Using python 2.4/2.5 is bad though since python 2.6 and 2.7 are out for a long time now. – ThiefMaster Aug 20 '11 at 09:52
  • @ThiefMaster: I am having trouble thinking of something that is necessary if you don't need it. – hughdbrown Aug 24 '11 at 19:42
  • I didn't say it's necessary. But if you need multiple python versions you unlikely need more than a recent 2.x and 3.x version. – ThiefMaster Aug 25 '11 at 07:24

4 Answers4

2

Are you using virtualenv? If not, you definitely want to check that out: http://pypi.python.org/pypi/virtualenv

It helps you by managing and switching between several virtual Python environments, with different versions of Python if you want to.

There are loads of tutorials of how to set it up, all over dem interweb.

Legogris
  • 253
  • 1
  • 7
  • 1
    I don't understand how virtualenv helps me with my problem. Can I change Python version used by virtual environment "on the fly"? – utapyngo Aug 20 '11 at 08:09
  • You could set up several virtual environments, one for each Python version that you want to work with, and then just switch between them as you want. It sounds like a headache to try to keep your entire environment except for the Python installation itself. – Legogris Aug 20 '11 at 08:17
2

What Legogris said: use virtualenv.

I just answered a question on pip, virtualenv, and virtualenvwrapper applicable here. I highly recommend this combination of tools for maintaining isolated python environments.

As a further point, I strong recommend using the no-site-packages option so that each virtualenv has all its requirements in one place.

Community
  • 1
  • 1
hughdbrown
  • 47,733
  • 20
  • 85
  • 108
1

Because some modules contain binary code which is linked agains a specific Python version, it will not be possible to instal a module only once. You will always have to install it for each installed version. But if you use pip, you should have a look at pip: dealing with multiple Python versions? Just create a batch file which calls pip for each installed version. That should at least simplify your life.

Community
  • 1
  • 1
Achim
  • 15,415
  • 15
  • 80
  • 144
-3

I'm not aware of any Python facility for doing that, that's really the OS's job. Debian/Ubuntu, for example, has support for installing multiple versions of Python and installing libraries into each version. I doubt there's any such support in Windows.

Ross Patterson
  • 5,702
  • 20
  • 38