Reputation: 1885
I'm currently toying with python at home and I'm planning to switch to python 3.1. The fact is that I have some scripts that use python 2.6 and I can't convert them since they use some modules that aren't available for python 3.1 atm. So I'm considering installing python 3.1 along with my python 2.6. I only found people on the internet that achieve that by compiling python from the source and use make altinstall
instead of the classic make install
. Anyway, I think compiling from the source is a bit complicated. I thought running two different versions of a program is easy on Linux (I run fedora 11 for the record). Any hint?
Thanks for reading.
Upvotes: 2
Views: 5388
Reputation: 101196
Why do you need to use make install
at all? After having done make
to compile python 3.x, just move the python folder somewhere, and create a symlink to the python executable in your ~/bin
directory. Add that directory to your path if it isn't already, and you'll have a working python development version ready to be used. As long as the symlink itself is not named python (I've named mine py
), you'll never experience any clashes.
An added benefit is that if you want to change to a new release of python 3.x, for example if you're following the beta releases, you simply download, compile and replace the folder with the new one.
It's slightly messy, but the messiness is confined to one directory, and I find it much more convenient than thinking about altinstalls and the like.
Upvotes: 0
Reputation: 43436
On my Linux system (Ubuntu Jaunty), I have Python 2.5, 2.6 and 3.0 installed, just by installing the binary (deb) packages 'python2.5', 'python2.6' and 'python3.0' using apt-get. Perhaps Fedora packages them and names them as RPMs in a similar way.
I can run the one I need from the command line just by typing e.g. python2.6
. So I can also specify the one I want at the top of my script by putting e.g.:
#!/usr/bin/python2.6
Upvotes: 5
Reputation: 8810
Download the python version you want to have as an alternative, untar it, and when you configure it, use --prefix=/my/alt/dir
Cheers
Nik
Upvotes: 2
Reputation: 391846
You're not supposed to need to run them together.
2.6 already has all of the 3.0 features. You can enable those features with from __future__ import
statements.
It's much simpler run 2.6 (with some from __future__ import
) until everything you need is in 3.x, then switch.
Upvotes: 1