First of all, I don't see a point to show you how to install Python on Windows. It's dead easy download the installer from python.org and in few clicks you will have python up and running. Installing Python on Linux is bit different and requires some pre-work to be done.
So Let's get started.
To be able to compile Python Source, you will need few packages. Fire up the terminal and execute this command
Step 2: Downloading Python Sources and extracting them on your disk
Download a tarball from the python site here is a direct link. Once, the download is completed you can extract the files by doing a right-click on the file and then clicking the extract option
Fire up a new Terminal and execute the following commands individually.
1. ./configure
2. make
3. sudo make altinstall
Hope this Helps! Please write your comments it will help me improve.
So Let's get started.
Note: Every Modern Linux had a python Installed. You can verify this by opening your Terminal and typing python. It will open the python shell for you. Do not remove the installed version.Step 1: Pre-requisites for Ubuntu
To be able to compile Python Source, you will need few packages. Fire up the terminal and execute this command
sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-devIt will take some time to finish depending upon your bandwidth. :)
Step 2: Downloading Python Sources and extracting them on your disk
Download a tarball from the python site here is a direct link. Once, the download is completed you can extract the files by doing a right-click on the file and then clicking the extract option
OR
Fire up the terminal and execute this command which will download the file first and extract it on the disk.wget http://www.python.org/ftp/python/3.2/Python-3.2rc2.tgz && tar -xvf Python-3.2rc2.tgzStep 3: Installing Python 3.2
Fire up a new Terminal and execute the following commands individually.
1. ./configure
2. make
3. sudo make altinstall
Hope this Helps! Please write your comments it will help me improve.
solves the 'missing bits' for the:
ReplyDelete_tkinter
_gdb
thanks
thanks for the article.. But when i run the command python in the terminal it still opens the 2.6.6 interpreter by default.. How do i run the programs in python 3.2 interpreter.. thanks in advance
ReplyDeleteHi,
ReplyDeleteIf you are running python script than you just have to change the shebang line to
#!/usr/local/bin/python3.2
, and if you are running the python interpreter instead of typing python in the terminal or console type python3.2
Hope this Helps!. If you still have doubts chat with me on meebo, if i am online or post in your comments i try to help. :)
Regards,
Karan
Thanks! I was going to install python 3 since 2.7 came up as the default for ubuntu 12.10. At the terminal I tried 'python3' and it switched to latest version.
Deletethanks, was able to get 3.2 installed without any problems
ReplyDeleteSince its launch became official, python 3.2 is no longer a rc(release candidate), hence the link for the tarball as well as the direct link no longer work; heres the corrected link.
ReplyDeletehttp://www.python.org/ftp/python/3.2/Python-3.2.tgz
Thank you, I'm going to try this.
ReplyDeleteWhat do the libxxxx files do in the sudo command? How did you know they were necessary? (I'm new to Linux (Ubuntu10.04) as well as to Python)
Dear User,
ReplyDeleteThere is actually nothing to tell you. The best way to find out is try to execute the ./Configure command without installing anything. You will get your answer pretty much. :-)
Hope this Helps!
Regards,
Karan
Had the same issue on the command line of the 'python' command firing up the 2.6.6 interpreter. Should have guessed that python3.1 would do the trick but didnt! Just want to say thanks Karan.
ReplyDeleteDear User,
ReplyDeleteDo you still face the same problem? It would be good enough if you try to explain me your scenario again. I try to help. :-)
I don't know which version you installed. If you installed 3.2 then type 'python3.2' it will fire python 3.2 interpreter.
Hope this Helps!
Regards,
Karan
Dont worry it is working fine - I have 3.1 installed and can use python3.1 with success. I was simply expressing my thanks :)
ReplyDeleteHi,
ReplyDeletein a reply, executing the './configure' command won't really give him a definite answer because he would first have to navigate 'cd' to the directory his package was in, mine for example was in a very weird directory, 'cd Downloads/shantz-xwinwrap/Pythong-3.2' but also, I am having trouble finding the command to exectue the program itself after the installation.
Any help?
Hi Pat,
ReplyDeleteYes, You are right i haven't mentioned any steps on how to navigate to the folder. But at the same time i believe it's not required. why? Because i asked him to skip the Prerequisites step only. About your second question if you have installed python 3.2 then fire up your terminal or console whatever, the Linux you are running and type in python3.2 it will fire up the python 3.2 interpreter.
Hope this Helps!
Regards,
Karan
I still need some blanks filled in about install process.
ReplyDeleteI downloaded the 3.2 tar to my ~ directory on Ubuntu 10.10.
I'm currently running the 'make', and will follow with the 'sudo make altinstall'.
Currently, all of the source in under my ~... which is okay.
After the 'sudo make altinstall', I will have both Python 2 and Python 3 on my desktop... which is what I want.
Apparently, I will use 'python' to bring up the currently supported Ubuntu version of Python 2, and 'python3.2' to bring up Python 3.2.
Question 1 -- (maybe already answered by reading the comments)
about halfway down, you mention how to completely change the version of python loaded by default... by changing "change the shebang line to
#!/usr/local/bin/python3.2".
Correction: The instructions were referring to the .py programs not a script file in /etc or /usr/bin or somewhere hidden that controls the startup of python.
I think I just answered my own question about WHERE python 3.2 will reside. Further, I realize that I can make devel directories at ~/python2 and ~/python3 to keep the different versions of the scripts apart... and the .py scripts in ~/python3 will all use the new "shebang" line.
Probably, never mind.
Webtech65, tbh... I really don't know what exactly needs to be filled by me in the install process. Or to what extent you did by posting such a huge comment which i really appreciate. None the less my objective is to make myself and mostly those people who come to this blog to understand the installation process. So, feel free to post in your comments about your experiences so we can also learn.
ReplyDeleteHope this Helps!
Regards,
Karan
Hello! Quite nice quick install guide :)
ReplyDeleteFew comments though...
1. this is the updated link:
wget http://www.python.org/ftp/python/3.2/Python-3.2rc3.tgz && tar -xvf Python-3.2rc3.tgz
2. you've forgot to mention on the install section that
./configure
make
sudo make altinstall
...must be run in the Python-3.2rc3 folder.
Don't you think it's understood? But if not for anyone than please assume it. Thank you user for your comment. Much Appreciated. :-)
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteits no longer rc2
ReplyDeleteAt the time of writing this post. Only Release Candidate is available.
ReplyDeletestep2 is not working,.im getting an error in the terminal after running this step2,.the error is...
ReplyDelete404 page not found..
Please lemme know another way to continue the installation of python 3.2 in my system.
Thank you,..
Nikhil, That link is not working because python 3.2 launch became official, Here is the corrected link.
ReplyDeletehttp://www.python.org/ftp/python/3.2/Python-3.2.tgz
* Fixed the link in the post above.
ReplyDeleteHi,How can I import wx? Am new to python, using ubuntu 11.04 python 3.2, IDLE3.
ReplyDeleteWith python2.7 no import error. Changing sys.path does not seem to help.
Current wx sys.path: '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode'.
Any advise? Thanks.
Hi Karan,
ReplyDeleteThank you for your instructions!
If anybody reading this was supposed to know what to do, what was the point of this? Even following these instructions there are steps missing that I can't figure out.
ReplyDeleteI'd like to thank you a lot for this help
ReplyDeletehola es genial
ReplyDeletepero no puedo ver las librerias de gtk y webkit
alguna solucion a esto???
saludos
./configure
ReplyDeletemake
sudo make altinstall
...must be run in the Python-3.2rc3 folder.
How do I do that? Thanks.
How can I make version3.2 as the default interpreter (and not 2.7) ?
ReplyDeleteWhen I type python on a terminal is the version 2.7 that is invoked (I have to explicitly type "python3.2" to get the latests version.
I have no option to chooce in two steps the version (I have seen somewhere something similar to this I think)
I hope that you understood, sorry for my English...I tried..
E:couldn't find package build-essential
ReplyDeleteam new to linux
If you have ubuntu 64 bit, go to the Python site and download the tarball available for linux.
ReplyDelete$ cd (where you have downloaded it to)
$ tar xvfz Python 3.2.2.tgz
$ Python 3.2.2/configure
$ make
$ make test #this takes a while
$ sudo make altinstall
If you use Aptana Studio, you will have to configure your python interpreter.
Each python file should have ..
#!"usr/bin/Python.3.2.2"
I tried these steps in ubuntu 12.04.1 LTS
DeleteAfter $ sudo make altinstall
it asks [sudo] password:
but the problem is it neither allows me to write password
and the msg sorry try again ,later after enter is pressed..
i am trying to instal python 3.2.3..
any solution???
You never see password typed in Linux terminals.. Just type the password and then press enter it will accept it. A security feature of linux that won't allow leave foot printing that is the reason when you type password in linux it looks like it was not accepting anything.. rest assured it is working. :)
DeletePlease see this: http://linuxgazette.net/35/tag/passwd.html
DeleteThanks ... it helped me a lot while installing it .... then wat about use of network and curses resources????
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThank you! Helped a lot. Though I needed to read the comments to understand how to do the installing part, but it was ok. Thanks again.
ReplyDeleteDanke
ReplyDeletemit dem aktuellen Paketnamen gelingt die Installation (Ubuntu lucid) problemfrei
thanks it helped!
ReplyDeleteI followed the instructions to install python3.2 (on Ubuntu 10.04) but when I typed $ python3.2 in terminal, the output is: command not found. Can somebody help me??
ReplyDeleteDear Anonymous User,
DeleteDid you see any error at the time of installation? I don't see any point why it shows command not found. I request you to go through the Installation Procedure again and read out all the comments that others have concerns and do let me know if it solves your problem. If it's still unresolved please revert back here.. I try to see what I can do... :)
Hello! Thank u nice quick install guide! :)
ReplyDeleteEverything went fine upto this point:
ReplyDeleteFire up a new Terminal and execute the following commands individually.
1. ./configure
Then I get this -
bash: ./configure: No such file or directory
Hi gareth,
DeleteSorry for replying you so late but it seems you have not cd to the directory where you have extracted the files otherwise you won't see such error. One thing you can do is to check is to list down (command `ls`) the current directory and see if configure file is present on your path. Please let me know if its still not resolved.
Sweet! Thanks for the help!
ReplyDeleteMany thanks!
ReplyDeleteThank you so much! All other resources go part way with the install. I was beginning to think that installing 3.2.3 was not possible with Lucid.
ReplyDeleteThanks it was of great helo
ReplyDeleteHi I managed to install en start the interpreter and it's showing Python 3.3.2 (like I wanted).
ReplyDeleteJust can' seem to get it to start default. I still get Python 2.6
* just for your info; i'm installing on OMV with Putty. Commands work the same.
regards,
MassaReal
I'm sorry for replying late.
DeleteAs this tutorial tells you if you install python 3.2 to bring the newly installed python interpreter you need to type python3.2.
As you have installed python3.3 try that instead and see if it works. I prefer to check the installation dir and see what name it is.
Hope this Helps!
Hello,
ReplyDeleteCan you also tell , how to install simplegui module for python?
Thanks...
Hi User,
DeletePlease refer this page. Download the tool below and install using the given instruction:
http://florian-berger.de/en/software/simplegui
Many thanks! Your instructions worked just fine for installing and running Python 3.3.2 (with the obvious minor changes in version number).
ReplyDeleteGlad it helped! :)
DeleteHi,
ReplyDeleteCan you tell me how to install 32bit python on a 64bit Ubuntu machine? I need to install python 2.7.6 32bit. The machine already have python2.7 and python3.3 64bit.
Ubuntu version is 13.04 (raring)
Hi,
ReplyDeleteCan you please tell me how to install 32bit python(2.7) on a 64bit Ubuntu (13.04) machine. The machine already contains python 3.3 and python 2.7 64bit version.
Hey Bharathi,
DeleteTry this: http://askubuntu.com/questions/29253/how-can-i-install-a-32bit-python-on-64-bit-ubuntu
while trying to install packages,it provides the following type of error.
ReplyDeletekingmaker@kingmaker-HP-Pavilion-15-Notebook-PC:~$ sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libreadline5-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libreadline-gplv2-dev:i386 lib64readline-gplv2-dev:i386
E: Package 'libreadline5-dev' has no installation candidate
kingmaker@kingmaker-HP-Pavilion-15-Notebook-PC:~$
please help me to solve it.....
First: Try sudo apt-get update If it won't work share your OS details. :)
ReplyDelete