PDA

View Full Version : Python 3.1



seelk
August 16th, 2009, 06:08 PM
Is there a guide that shows how to go by compiling and updating Python to the latest 3.1? Currently Python 2.6.2 is installed in Jaunty but I would like to update it to 3.1. Is this possible? Maybe there's a repository?

DirtDawg
August 16th, 2009, 06:22 PM
Is there a guide that shows how to go by compiling and updating Python to the latest 3.1? Currently Python 2.6.2 is installed in Jaunty but I would like to update it to 3.1. Is this possible? Maybe there's a repository?

Python 3.0 is in the repositories:

sudo apt-get install python3.0

I believe Python 3.0 will be installed along side, rather than replace, Python 2.6.

If you really need 3.1, you will probably need to compile it from source.

trilobite
August 17th, 2009, 08:21 AM
Python 3.0 is in the repositories:

sudo apt-get install python3.0

I believe Python 3.0 will be installed along side, rather than replace, Python 2.6.

If you really need 3.1, you will probably need to compile it from source.

Agreed, DirtDawg. Actually, 3.1.1 is coming out soon, so that may be worth waiting for.
Anyway, it's very easy to compile it from source.

Just grab the tar.bz2 or tar.gz file from python.org, download it to your home directory and do the following on the command-line -

a) tar -zxvf Python-3.1.tar.gz2
( or tar -xjvf Python-3.1.tar.bz2 if you get that one )
b) cd Python-3.1
c) ./configure
d) make
e) su make install
f) make clean ( to clean out all of the unneeded bits after the compile).

The compile *can* take a while, iirc (I think it took me between 45 min to an hour or so).

Then, all you have to remember is to call it by typing "python3.1" (without the quotes) on the command-line. Just typing "python" starts the default version (2.6.2 in my Jaunty install).
- Hope this helps..... :)
- trilobite

seelk
August 17th, 2009, 06:13 PM
Thank you guys for your help. Question, does the "make install" of the 3.1 source install IDLE 3.1? If so, I'll take this route.

trilobite
August 18th, 2009, 09:58 AM
Thank you guys for your help. Question, does the "make install" of the 3.1 source install IDLE 3.1? If so, I'll take this route.

Hi -

No, IDLE is a separate package, I'm afraid, so you'll need to install that separately.

If you're interested in a general IDE (not just for Python), I recommend Geany (http://www.geany.org). It's very easy to use and is really well-designed - not cluttered at all, unlike some other IDEs.
- trilobite

HorstJENS
September 26th, 2009, 07:49 AM
e) su make install


had to type:


sudo make install

because
su was not working.
-Horst

Wink2tall
February 4th, 2010, 05:19 PM
Thanks trilobite! A major help, specially for people new to Ubuntu like me.

MikeyDL
March 11th, 2010, 07:44 PM
Hi, I tried this and was able to compile and install Python 3.1.2. But when I ran "Python" from the terminal I still got the old 2.6 version. Do you have to uninstall 2.6 first? I did a "sudo dpkg -l | grep Python" but came up with allot of packages and didn't want to uninstall on all the different ones that popped up.

Also was following the readme file and didn't do the clean optioned mentioned above. Would that have cleaned out the older version?

Thanks!

MikeyDL
March 11th, 2010, 10:03 PM
Actually did a bit more reading on the forums. There were allot of warnings not to uninstall Python 2.6 because of it's links to other apps and that you could have multiple versions running. I was reading about just linking the python link in /usr/bin/ to the new 3.1.2 version.

So i downloaded the latest 3 version from python.org ran through the readme instructions and installed. But there wasn't a python executible for 3 in /usr/bin like there is for 2.6. running "Python" from the terminal just seems to run the 2.6 version.

If you can have multiple versions running how do you run the 3.1 version? Is there an executible that should be put into /usr/bin?

Also I extracted the tar into ~/Downloads directory. Do you need to run the make and config from a specific location to install when you run a compile? Maybe I just installed it wrong.

Bachstelze
March 11th, 2010, 10:38 PM
If you can have multiple versions running how do you run the 3.1 version? Is there an executible that should be put into /usr/bin?

You run Python 3.1 by typing python3.1 or python3. The executable is in /usr/local/bin.


Also I extracted the tar into ~/Downloads directory. Do you need to run the make and config from a specific location to install when you run a compile? Maybe I just installed it wrong.

No, what you did is fine. And by the way, yes, it did install IDLE 3.

MikeyDL
March 12th, 2010, 04:52 AM
Thanks! That worked!:p