Search This Blog

Sunday, April 29, 2012

Install Python 3 on Linux Mint

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.

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-dev
It 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.tgz
Step 3: Installing Python 3.2

Fire up a new Terminal and execute the following commands individually.

1.   ./configure
2.   make
3.  sudo make altinstall

7 comments:

  1. 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-dev

    It will take some time to finish depending upon your bandwidth. :)

    When I run the first step something came up

    sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev
    [sudo] password for m364n0:
    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 lib64readline-gplv2-dev

    E: Package 'libreadline5-dev' has no installation candidate

    So I run this command:

    sudo apt-get install build-essential libncursesw5-dev libreadline-gplv2-dev lib64readline-gplv2-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev

    ReplyDelete
  2. The background is awful... Now, I can read text :)

    ReplyDelete
  3. Replies
    1. Gday Abhishek Sarkar,
      I followed your directions and got pretty much the same as "anonymous november 10,2012" but went ahead anyway and finished with

      /usr/bin/install -c -m 644 ./Misc/python.man \
      /usr/local/share/man/man1/python3.2.1

      now for the love of linux, I have no idea how to get programs to use python 3.2.1 in liu of python 2.7.3 installed in my mint 13 distro.....

      python --version
      Python 2.7.3

      I am aware that this is almost 12 months old but please reply if you can to oldmanroo@gmail.com

      Delete
  4. Hi, how can i run the python 3? already installed i just can't run it xD I am kinda noob in linux

    ReplyDelete
    Replies
    1. i already found how to do it, thx anyway:)

      Delete