954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to install Python3.1 on Ubuntu/Linux

I am still rather new to the Linux OS and need some detailed advice on the installation of Python3.1 on my Ubuntu machine.

Python3.1 is not in the Ubuntu package repository yet.

sneekula
Nearly a Posting Maven
2,427 posts since Oct 2006
Reputation Points: 961
Solved Threads: 212
 

In Linux Mint, you just to go to Package Manager, and tick Python, and install it, dunno whether it works for Linux or not!

sravan953
Posting Whiz in Training
243 posts since May 2009
Reputation Points: 2
Solved Threads: 30
 

I am still rather new to the Linux OS and need some detailed advice on the installation of Python3.1 on my Ubuntu machine.

Python3.1 is not in the Ubuntu package repository yet.


If you perform an apt-cache search python | grep -E "31|3\.1" do you get any hits?

Alternately try an apt-cache search python3 . If nothing comes up for either query then you'll need to go the manual route.

jlm699
Veteran Poster
1,112 posts since Jul 2008
Reputation Points: 355
Solved Threads: 292
 

This question is better asked/searched on Ubuntu's forums. The answer is something in the neighborhood of copying the 3.0 install and changing to 3.1, to or use apt-get's install from source-I haven't done it but this might help https://lists.ubuntu.com/archives/ubuntu-users/2005-July/042275.html
http://www.debian.org/doc/manuals/apt-howto/ch-sourcehandling.en.html

If you do install from source, (not the same as using apt-get to install from source), read the README file, as you have to do something like "make alt-install" otherwise it could overwrite an existing Python install instead of installing in a separate library directory.

woooee
Nearly a Posting Maven
2,454 posts since Dec 2006
Reputation Points: 777
Solved Threads: 714
 

Ok what you do is download the python 3.1 .tar.bz2 file here . extract it to your desktop. this is my website and its unfinished...

enter this in your terminal..

cd  ~/Desktop/Python-3.1/

./configure


if this turns up no errors continue else your missing some dependencies.

make

sudo make install


enter your password and vwala...

by the way it will make 3.1 your default python interpreter... read the readme in the python folder that you extract to see what commands you have to enter to make it your secondary interpreter...

the last two commands will take awhile...
this worked on Ubuntu 9

Arrorn
Light Poster
40 posts since Mar 2009
Reputation Points: 7
Solved Threads: 5
 

If you perform an apt-cache search python | grep -E "31|3\.1" do you get any hits?

Alternately try an apt-cache search python3 . If nothing comes up for either query then you'll need to go the manual route.

Thanks Jim, your first suggestion gives me:

dell@dell-laptop:~$ apt-cache search python | grep -E "31|3\.1"
python-xen-3.1 - python bindings for Xen, a Virtual Machine Monitor
dell@dell-laptop:~$


Your second code finds nothing, so it looks that Python3 it isn't there yet.

sneekula
Nearly a Posting Maven
2,427 posts since Oct 2006
Reputation Points: 961
Solved Threads: 212
 

Arrorn, thanks for your info.

I download Python-3.1.tar.bz2 from:
http://www.python.org/download/releases/3.1/

Extracted to the Desktop

On the Terminal I did a:
cd ~/Desktop/Python-3.1/

Then I followed the readme file for the installation on Linux

All of it worked great!

Now I need friendly advice on running idle.pyw in directory
/usr/local/lib/python3.1/idlelib with Python3.1

sneekula
Nearly a Posting Maven
2,427 posts since Oct 2006
Reputation Points: 961
Solved Threads: 212
 

under applications press add and remove...

search for IDLE

look for the IDLE with Python version 3 on it not the 2.5 or 2.6 version... add it and go to applications programming to run it...
to set IDLE as the default open option for .py files...
1) right click on a .py file...
2) go to properties.
3) go to the open with tab.
4) left click + add.
5) left click custom command.
6) left click browse.
7) locate the file idle-python3.0 in the directory /usr/bin/.
8) add that as the default and it will open up an IDLE shell every time you double click on a .py file...

yay Ubuntu Linux....

the irony is that currently i'm doing very little programming on my ubuntu computer. i use it for web surfing... currently i'm on my 64-bit vista computer....

Little tip for python 3.1: it won't recognize the module Tkinter it is renamed to tkinter...

Arrorn
Light Poster
40 posts since Mar 2009
Reputation Points: 7
Solved Threads: 5
 

I have a /user/bin/python2.5 link to that version's executable, also /user/bin/python links to there. There is no /user/bin/python3.1 link or a /user/bin/idle-python3.1. How do I create such a link?

sneekula
Nearly a Posting Maven
2,427 posts since Oct 2006
Reputation Points: 961
Solved Threads: 212
 

I have the Geany IDE originally installed under Python2.5 on my Ubuntu machine.
To run a script with Python3.1 with the Geany IDE you can set 'Build' --> 'Set Includes and Arguments' --> 'Execute' to python3.1 "%f"

For some odd reason my shebang line
#!/usr/local/bin/python3.1
doesn't seem to respond.

sneekula
Nearly a Posting Maven
2,427 posts since Oct 2006
Reputation Points: 961
Solved Threads: 212
 

there is no idle-python3.1 file for ubuntu it is still idle-python3.0... they just updated the syntax or something but it is still IDLE 3.0.... even though the interpreter is with version 3.1....

Arrorn
Light Poster
40 posts since Mar 2009
Reputation Points: 7
Solved Threads: 5
 

to all the n00bs out there, like myself, with Fedora 11 or less, just do

yum install tk-devel
./configure
make
make install

all within the extracted python download folder.

You have have to re-configure, re-make, and re-install python, if you've already done so, after installing tk-devel

pdxwebdev
Newbie Poster
8 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You