146

Q: Do we have anything functionally equivalent in Python to the Ruby version manager 'rvm'?


(RVM lets you easily switch completely between different versions of the ruby interpreter and different sets of gems (modules). Everything concerning download-build-install-switch of interpreter(-s) and gems gets taken care of by invoking rvm. It is all run under your regular user account.)

conny
  • 9,012
  • 6
  • 35
  • 43

6 Answers6

96

Yes, it is virtualenv along with virtualenvwrapper.

update: you may install both at once with virtualenv burrito.

Update: the correct answer is now probably pyenv.

For scientific computing, the corresponding tool is anaconda.

Olivier Verdier
  • 41,410
  • 26
  • 94
  • 89
  • Ah, yeah because virtualenv by itself is too low level for pretty much any use other than creating your own wrapper... Thanks for the pointer, I'm looking at http://vimeo.com/5894881 now :) – conny May 12 '10 at 10:29
  • 3
    I'm confused. Where can you install different versions of python? It seems to be just using the system's version of python. – docwhat Oct 06 '10 at 00:50
  • 2
    Each virtualenv is tied to a particular version of Python. You may thus use different versions of Python across your virtualenvs. – Olivier Verdier Oct 06 '10 at 07:53
  • 4
    But is there a way to bundle a specific Python install (say, 2.7) with certain eggs in one project, and with certain other eggs in another? RVM manages all this stuff seamlessly, and `sudo` is a thing of the past. – Kyle Wild Apr 05 '11 at 15:56
  • 4
    Virtualenv allows to juggle between versions of Python, and between different sets of eggs; but it won't deal with the compilation+installation of Python itself. RVM does exactly that for Ruby. If you want to build a specific version of Python because you can't install it out of packages for some reason, then you want to check pythonbrew instead (just the other answer just below). – jpetazzo Nov 21 '11 at 23:25
  • 3
    I don't see how this supports several versions of python. – Dogweather Sep 27 '13 at 20:53
  • 3
    RVM does take care for compiling Ruby interpreters. It also allows downloading precompiled ones, if available. – Andrey Mikhaylov - lolmaus Jul 30 '14 at 17:15
  • I really like your use of strikethrough to show what used to work compared to what you felt was best after your latest edit. – labyrinth Jun 27 '17 at 20:21
  • @docwhat this is now possible it seems: https://stackoverflow.com/a/59268119/895245 – Ciro Santilli新疆棉花TRUMP BAN BAD Dec 10 '19 at 13:16
85

Pythonbrew is no longer under development. The former maintainer suggests to use "PyEnv" instead (see below)".

pythonbrew has come! http://github.com/utahta/pythonbrew

pyenv: https://github.com/yyuu/pyenv

Peter Ehrlich
  • 6,586
  • 4
  • 44
  • 58
hytdsh
  • 851
  • 1
  • 6
  • 2
51

I created pyenv which is a fork of Ruby's rbenv and modified for Python. Like pythonz, pyenv also supports Stackless, PyPy, and Jython.

Yuu Yamashita
  • 611
  • 5
  • 3
6

Following up on hytdsh's answer (nearly two years later)...

pythonz a fork of pythonbrew that adds support for Stackless, PyPy, and Jython.

If you like how rvm handles different interpreters, it may worth taking a look at pythonz. If you're strictly working with CPython, the difference is less significant.

Chris Olstrom
  • 71
  • 1
  • 4
5

Optionally, if you're using Macports you can use python_select. Install python_select with:

$ sudo port install python_select

Assuming python 2.6 and 2.5 have bee installed via Macports you can switch pythons like so:

$ sudo python_select python25
=> Selecting version "python25" for python
$ python --version
=> 2.5.5
$ sudo python_select python26
=> Selecting version "python26" for python
$ python --version
=> 2.6.6
sahglie
  • 136
  • 1
  • 3
1

pyenv 1.2.15 can build and install Python for you

Maybe this was not possible in earlier version, but when I tested in 1.2.15 I noticed the pyenv install option which worked:

pyenv install 3.8.0

Therefore I feel that it is reasonable to call pyenv a replacement for RVM.

I have given a fully detailed example of its usage at: apt-get install for different python versions