How to install Python on Debian GNU/Linux (Python-2.7.2.tar.bz2)

Discussion in 'Python' started by patrickwayodi, Dec 5, 2011.

  1. Hi,
    How can I install Python on Debian GNU/Linux? I downloaded the file
    "Python-2.7.2.tar.bz2" but I don't know how to install it.

    Patrick.
     
    patrickwayodi, Dec 5, 2011
    #1
    1. Advertising

  2. On Tue, Dec 6, 2011 at 1:53 AM, patrickwayodi <> wrote:
    > Hi,
    > How can I install Python on Debian GNU/Linux? I downloaded the file
    > "Python-2.7.2.tar.bz2" but I don't know how to install it.


    You should actually already have Python installed. Try typing 'python'
    at a terminal and see if it invokes the interactive interpreter.

    ChrisA
     
    Chris Angelico, Dec 5, 2011
    #2
    1. Advertising

  3. > You should actually already have Python installed. Try typing 'python'
    > at a terminal and see if it invokes the interactive interpreter.
    >
    > ChrisA



    Yes, I have Python installed, but it's an old version. So I want to
    upgrade to "Python-2.7.2.tar.bz2".
     
    patrickwayodi, Dec 5, 2011
    #3
  4. On Tue, Dec 6, 2011 at 2:40 AM, patrickwayodi <> wrote:
    >> You should actually already have Python installed. Try typing 'python'
    >> at a terminal and see if it invokes the interactive interpreter.
    >>
    >> ChrisA

    >
    >
    > Yes, I have Python installed, but it's an old version. So I want to
    > upgrade to "Python-2.7.2.tar.bz2".


    Ah gotcha. I believe you can 'sudo apt-get install python2.7' - at
    least, you can on the Ubuntu system next to me. Not sure though; I
    build my Python from source straight from Mercurial.

    What you have there, I think, is a source code snapshot. You'd need to
    extract it and then do the usual incantation:
    $ ./configure
    $ make
    $ sudo make install

    If you don't have the compiler/build environment set up, you'll have
    to do that first. If you aren't too concerned about the exact version
    you get, the above apt-get line should get you a stable Python in the
    2.7 branch.

    ChrisA
     
    Chris Angelico, Dec 5, 2011
    #4
  5. Re: How to install Python on Debian GNU/Linux(Python-2.7.2.tar.bz2)

    On Tue, 06 Dec 2011 02:51:21 +1100, Chris Angelico wrote:

    > On Tue, Dec 6, 2011 at 2:40 AM, patrickwayodi <>
    > wrote:
    >>> You should actually already have Python installed. Try typing 'python'
    >>> at a terminal and see if it invokes the interactive interpreter.
    >>>
    >>> ChrisA

    >>
    >>
    >> Yes, I have Python installed, but it's an old version. So I want to
    >> upgrade to "Python-2.7.2.tar.bz2".

    >
    > Ah gotcha. I believe you can 'sudo apt-get install python2.7' - at
    > least, you can on the Ubuntu system next to me. Not sure though; I build
    > my Python from source straight from Mercurial.
    >
    > What you have there, I think, is a source code snapshot. You'd need to
    > extract it and then do the usual incantation: $ ./configure
    > $ make
    > $ sudo make install


    And you have now potentially broken your system python :(

    Generally speaking, unless you are an expert, you should not use make
    install when installing Python from source, because it will replace the
    system Python with the newly installed one.

    Instead use `sudo make altinstall`. This is exactly the same as install,
    except it won't replace the python symlink that points to the actual
    Python executable. That way system tools that call Python get the version
    they are expecting, together with any libraries installed for their use,
    while you can call the version you prefer manually. Or set up an alias in
    your bashrc file.


    > If you don't have the compiler/build environment set up, you'll have to
    > do that first.


    The trickiest part for me is ensuring that tkinter works correctly. After
    installing Python from source about a dozen times now, I still don't know
    why sometimes it works and sometimes it doesn't.


    --
    Steven
     
    Steven D'Aprano, Dec 5, 2011
    #5
  6. On Tue, Dec 6, 2011 at 3:23 AM, Steven D'Aprano
    <> wrote:
    > Generally speaking, unless you are an expert, you should not use make
    > install when installing Python from source, because it will replace the
    > system Python with the newly installed one.
    >
    > Instead use `sudo make altinstall`


    Mea culpa, forgot that. Yes, use altinstall. Although it's probably
    not a problem to replace 2.6.6 with 2.7.2 - I doubt that'll break many
    things.

    ChrisA
     
    Chris Angelico, Dec 5, 2011
    #6
  7. patrickwayodi

    Anssi Saari Guest

    Christian Heimes <> writes:

    >> Mea culpa, forgot that. Yes, use altinstall. Although it's probably
    >> not a problem to replace 2.6.6 with 2.7.2 - I doubt that'll break many
    >> things.

    >
    > Except that all 3rd party extensions and packages are missing if you
    > install Python manually.


    True, they would have to be built or at least installed manually also.
    Major work, especially for a beginner. Shouldn't pick Debian Stable and
    then want current software...

    Then again, even the standard install of Python has plenty of stuff. I
    installed 2.7.2 on my Debian system just to try out some of the new Tk
    stuff.

    > Debian's backports should provide a well integrated Python 2.7
    > package.


    But it doesn't. Python 2.7.2 is in Wheezy, which is the current testing
    version of Debian. Looks like it has about 700 release critical bugs, so
    it'll be a while until release.
     
    Anssi Saari, Dec 14, 2011
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Thorley

    handling tar, gz and bz2 with python

    Matthew Thorley, Apr 22, 2005, in forum: Python
    Replies:
    1
    Views:
    653
    Fredrik Lundh
    Apr 22, 2005
  2. Replies:
    3
    Views:
    468
    =?iso-8859-1?q?Lars_Gust=E4bel?=
    Aug 28, 2005
  3. Ray Van Dolson
    Replies:
    0
    Views:
    347
    Ray Van Dolson
    Sep 23, 2009
  4. Ray Van Dolson
    Replies:
    0
    Views:
    854
    Ray Van Dolson
    Sep 25, 2009
  5. Magdoll
    Replies:
    3
    Views:
    397
    Steven D'Aprano
    Jun 5, 2010
Loading...

Share This Page