Sunday, June 15, 2014

11:56 AM
Good day!

Upgrading your Python on a Linux is slightly risky as the apt is heavily upon the Python. You must have extra careful on doing this on your Linux box.

I have Python 2.7.6 as default version on my linux installation. I have followed the below instructions to upgrade my python into Python 3.3. It was very straightforward. Just download, compile and install. Take not that while installing you must have gcc, zlib, commands used in the instructions, and other similar packages already installed. Otherwise you cannot perform the following tasks.

1.) Download the Python.

$ wget http://python.org/ftp/python/3.3.0/Python-3.3.0.tar.bz2


2.) Extract the downloaded zip file.

$ tar jxf ./Python-3.3.0.tar.bz2

3.) Enter into the extracted directory

$ cd ./Python-3.3.0

4.) Configuring the installation with prefix.

$ ./configure --prefix=/opt/python3.3

5.) Make and install at the same time with sudo.

$ make && sudo make install

6.) Add symbolic link in your home folder or /usr/local/bin. (but this one is on current home directory of the logged user)

$ mkdir ~/bin
$ ln -s /opt/python3.3/bin/python ~/bin/py




Notes:
If you run into problem like these:
E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
Your dpkg has been locked due to unsuccessful installation you can execute the below command first and rerun the instructions above.

$ sudo rm /var/lib/dpkg/lock



That's it! Hope this helps Enjoy your upgraded Python.

0 comments:

Post a Comment