How to install the latest Python version on Debian separately or upgrade? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionRepairing python setupHow to specify the python path for pip?apt-get install packages for python2.7How can I have more than one possibility in a script's shebang line?How to remove a package built from source that has the same name of another package?How can I set up using a different version of Python from the OS?Make python 2.7 the default python in centos, making an alias didn't workHow to specify the python path for pip?Jenkins, Python and rootCentOS: How to force pip to install Django with latest Python 3.5How to install Python 3.6?Where is pdfwriter.py located?

What are the out-of-universe reasons for the references to Toby Maguire-era Spider-Man in Into the Spider-Verse?

Sum letters are not two different

Significance of Cersei's obsession with elephants?

Employee unreasonably upset with me?

What's the meaning of "fortified infraction restraint"?

Is there hard evidence that the grant peer review system performs significantly better than random?

Hangman Game with C++

Why do we bend a book to keep it straight?

How often does castling occur in grandmaster games?

Generate an RGB colour grid

How to write dimensions below a matrix

Physics no longer uses mechanical models to describe phenomena

What would you call this weird metallic apparatus that allows you to lift people?

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

Did Deadpool rescue all of the X-Force?

Can a new player join a group only when a new campaign starts?

Source for Esri sample data from 911 Hot Spot Analysis

How come Sam didn't become Lord of Horn Hill?

Why is it faster to reheat something than it is to cook it?

Maximum summed subsequences with non-adjacent items

What is a fractional matching?

What is the Characteristic of a local ring?

What is the meaning of the simile “quick as silk”?

Is there a kind of relay only consumes power when switching?



How to install the latest Python version on Debian separately or upgrade?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionRepairing python setupHow to specify the python path for pip?apt-get install packages for python2.7How can I have more than one possibility in a script's shebang line?How to remove a package built from source that has the same name of another package?How can I set up using a different version of Python from the OS?Make python 2.7 the default python in centos, making an alias didn't workHow to specify the python path for pip?Jenkins, Python and rootCentOS: How to force pip to install Django with latest Python 3.5How to install Python 3.6?Where is pdfwriter.py located?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








35















I'm still new to Linux, so I'm still trying to understand where executables and their libraries are and how to install packages, so I have Debian Wheezy 7.3 which has these Python versions:



  • Python 2.7.3 (default)

  • Python 2.6.8

So in the directory /usr/bin/ there are these files that I can call from the terminal:



  • python (which is a link to python2.7)

  • python2 (also a link to python2.7)

  • python2.6 (Python 2.6.8 executable)

  • python2.7 (Python 2.7.3 executable)

and in /usr/lib/, the main folders:



  • python2.6

  • python2.7

Currently the latest version of Python is 2.7.6 which I want to install, but I don't know how, I tried using apt-get:



apt-get install python


it outputs python is already the newest version..



So how can I install the latest version of Python ? on the Python download page there is the source tarball, how can I use that to install it separately like having another folder in /usr/lib/ like python2.7.6 and make the python link in /usr/bin/ point to the new executable, or maybe upgrade the current version if it won't break anything.










share|improve this question






















  • You could backport Python 2.7.6 from testing/unstable and replace your curent 2.7.3 with it. This will most likely not cause you any problems. If it does, you can easily revert back.

    – Faheem Mitha
    Jan 19 '14 at 15:48












  • I didn't even install it, fresh install of Debian and type "python" from the command line and I'm in the python3 shell.

    – frozenjim
    Jul 24 '15 at 11:00

















35















I'm still new to Linux, so I'm still trying to understand where executables and their libraries are and how to install packages, so I have Debian Wheezy 7.3 which has these Python versions:



  • Python 2.7.3 (default)

  • Python 2.6.8

So in the directory /usr/bin/ there are these files that I can call from the terminal:



  • python (which is a link to python2.7)

  • python2 (also a link to python2.7)

  • python2.6 (Python 2.6.8 executable)

  • python2.7 (Python 2.7.3 executable)

and in /usr/lib/, the main folders:



  • python2.6

  • python2.7

Currently the latest version of Python is 2.7.6 which I want to install, but I don't know how, I tried using apt-get:



apt-get install python


it outputs python is already the newest version..



So how can I install the latest version of Python ? on the Python download page there is the source tarball, how can I use that to install it separately like having another folder in /usr/lib/ like python2.7.6 and make the python link in /usr/bin/ point to the new executable, or maybe upgrade the current version if it won't break anything.










share|improve this question






















  • You could backport Python 2.7.6 from testing/unstable and replace your curent 2.7.3 with it. This will most likely not cause you any problems. If it does, you can easily revert back.

    – Faheem Mitha
    Jan 19 '14 at 15:48












  • I didn't even install it, fresh install of Debian and type "python" from the command line and I'm in the python3 shell.

    – frozenjim
    Jul 24 '15 at 11:00













35












35








35


14






I'm still new to Linux, so I'm still trying to understand where executables and their libraries are and how to install packages, so I have Debian Wheezy 7.3 which has these Python versions:



  • Python 2.7.3 (default)

  • Python 2.6.8

So in the directory /usr/bin/ there are these files that I can call from the terminal:



  • python (which is a link to python2.7)

  • python2 (also a link to python2.7)

  • python2.6 (Python 2.6.8 executable)

  • python2.7 (Python 2.7.3 executable)

and in /usr/lib/, the main folders:



  • python2.6

  • python2.7

Currently the latest version of Python is 2.7.6 which I want to install, but I don't know how, I tried using apt-get:



apt-get install python


it outputs python is already the newest version..



So how can I install the latest version of Python ? on the Python download page there is the source tarball, how can I use that to install it separately like having another folder in /usr/lib/ like python2.7.6 and make the python link in /usr/bin/ point to the new executable, or maybe upgrade the current version if it won't break anything.










share|improve this question














I'm still new to Linux, so I'm still trying to understand where executables and their libraries are and how to install packages, so I have Debian Wheezy 7.3 which has these Python versions:



  • Python 2.7.3 (default)

  • Python 2.6.8

So in the directory /usr/bin/ there are these files that I can call from the terminal:



  • python (which is a link to python2.7)

  • python2 (also a link to python2.7)

  • python2.6 (Python 2.6.8 executable)

  • python2.7 (Python 2.7.3 executable)

and in /usr/lib/, the main folders:



  • python2.6

  • python2.7

Currently the latest version of Python is 2.7.6 which I want to install, but I don't know how, I tried using apt-get:



apt-get install python


it outputs python is already the newest version..



So how can I install the latest version of Python ? on the Python download page there is the source tarball, how can I use that to install it separately like having another folder in /usr/lib/ like python2.7.6 and make the python link in /usr/bin/ point to the new executable, or maybe upgrade the current version if it won't break anything.







debian package-management python






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 19 '14 at 15:11









PierrePierre

6564918




6564918












  • You could backport Python 2.7.6 from testing/unstable and replace your curent 2.7.3 with it. This will most likely not cause you any problems. If it does, you can easily revert back.

    – Faheem Mitha
    Jan 19 '14 at 15:48












  • I didn't even install it, fresh install of Debian and type "python" from the command line and I'm in the python3 shell.

    – frozenjim
    Jul 24 '15 at 11:00

















  • You could backport Python 2.7.6 from testing/unstable and replace your curent 2.7.3 with it. This will most likely not cause you any problems. If it does, you can easily revert back.

    – Faheem Mitha
    Jan 19 '14 at 15:48












  • I didn't even install it, fresh install of Debian and type "python" from the command line and I'm in the python3 shell.

    – frozenjim
    Jul 24 '15 at 11:00
















You could backport Python 2.7.6 from testing/unstable and replace your curent 2.7.3 with it. This will most likely not cause you any problems. If it does, you can easily revert back.

– Faheem Mitha
Jan 19 '14 at 15:48






You could backport Python 2.7.6 from testing/unstable and replace your curent 2.7.3 with it. This will most likely not cause you any problems. If it does, you can easily revert back.

– Faheem Mitha
Jan 19 '14 at 15:48














I didn't even install it, fresh install of Debian and type "python" from the command line and I'm in the python3 shell.

– frozenjim
Jul 24 '15 at 11:00





I didn't even install it, fresh install of Debian and type "python" from the command line and I'm in the python3 shell.

– frozenjim
Jul 24 '15 at 11:00










4 Answers
4






active

oldest

votes


















16














You probably are looking for virtualenv or pyenv or some other non-system-wide method to install Python. The method using APT (Advance Package Tool) and dpkg, ensures that all parts of the system are working in harmony, so you maybe want to install python in a separated path, hidden of all the other programs that you can call at will, which is the purpose of pyenv/virtualenv. This answers how to install the latest version of python without breaking the system.



BTW, you can check out the latest version of python that Debian in madison, while the latest version of python 2 at the date is the one you pointed out:



➜ ~ apt-cache policy python
python:
Installed: 2.7.5-5
Candidate: 2.7.5-5
Version table:
*** 2.7.5-5 0
500 http://ftp.us.debian.org/debian/ testing/main i386 Packages
100 /var/lib/dpkg/status


(pythonbrew is not longer maintained).






share|improve this answer

























  • ok I installed pip and virtualenv as root, so how can I create a virtual environment with a new Python version ? as far as I know we need the new version to be installed first right ?

    – Pierre
    Jan 19 '14 at 16:27






  • 1





    @Peter I think that the first step is pyenv install 2.7.6. You can check all versions using pyenv install -l

    – Braiam
    Jan 19 '14 at 16:57



















27














Ok after a lot of searching I decided to build Python from source, so I downloaded the compressed source tarball from the Python download page, now we need to install the build-essential package to be able to compile the source files:



apt-get install build-essential


also we need to install these development packages which are required for some Python modules:



libbz2-dev
libsqlite3-dev
libreadline-dev
zlib1g-dev
libncurses5-dev
libssl-dev
libgdbm-dev


next we extract the downloaded source file:



tar zxf Python-2.7.6.tgz


then we cd into the extracted directory:



cd Python-2.7.6


and follow the instructions on the Python docs:



./configure --prefix=/opt/python
make
make install # <- in the docs but don't execute: use checkinstall


I chose to install it under the directory /opt/python which I created before, also I used the checkinstall package to create a .deb file so I can uninstall easily later, so we install it first:



apt-get install checkinstall


and substitute the last line make install with:



checkinstall


now I have a new python installation in /opt/python/lib/python2.7 and the binary file is in /opt/python/bin/python2.7.



now I can run in the command line /opt/python/bin/python2.7 to use this Python version, also we can make a link to this executable so we don't type the full path, I named it python2.7.6.



ln -s /opt/python/bin/python2.7 /usr/local/bin/python2.7.6


also the directory /opt/python/bin will contain later other executables like pip and virtualenv or any other modules you install so we can add it to the PATH environment variable, edit ~/.profile and add this line:



PATH="$PATH:/opt/python/bin"


and run:



source ~/.profile


I appended the path to the end because it contains executable names like the ones in /usr/bin like python, python2 and python2.7 so we keep the higher priority for /usr/bin.






share|improve this answer

























  • Now, would you happen to know how to configure your new python to see modules that were installed via apt-get?

    – elsurudo
    Jan 27 '16 at 21:22











  • Unfortunately for Python 2.6, compiling from source doesn't work properly on Debian 8 (Jessie) but I found, at least for a Raspberry Pi, that I was able to use older packages from packages.debian.org. The order, assuming build-essentials are already in place is something like libdb, python2.6-minimal, python2.6, libpython2.6, python2-6-dev but dpkg -i will tell you what's needed.

    – Charlie Clark
    Apr 14 '16 at 10:29






  • 1





    @elsurudo That would not make sense really, because the modules might well be unsupported on your new version. If you want full control over your Python (as you do when compiling from source), you will want to install modules separately, too.

    – tripleee
    Oct 20 '16 at 8:01


















-1














you can use:



aptitude install python3.5 


or, if you haven't installed aptitude, then you can install it using:



apt-get install aptitude





share|improve this answer
































    -1














    I had the same question, I tried sudo apt-get install python3 and it worked.



    $ ls /usr/bin/python*
    /usr/bin/python /usr/bin/python3 /usr/bin/python3m
    /usr/bin/python2 /usr/bin/python3.4
    /usr/bin/python2.7 /usr/bin/python3.4m






    share|improve this answer




















    • 2





      This is not working for debian, maybe for ubuntu or others...

      – piertoni
      Nov 18 '15 at 14:33











    • @piertoni It does work on many versions of Debian. In fact, you would have to be stuck on a release which is far out of support in order for this not to work.

      – tripleee
      Oct 20 '16 at 8:02











    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f110014%2fhow-to-install-the-latest-python-version-on-debian-separately-or-upgrade%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    16














    You probably are looking for virtualenv or pyenv or some other non-system-wide method to install Python. The method using APT (Advance Package Tool) and dpkg, ensures that all parts of the system are working in harmony, so you maybe want to install python in a separated path, hidden of all the other programs that you can call at will, which is the purpose of pyenv/virtualenv. This answers how to install the latest version of python without breaking the system.



    BTW, you can check out the latest version of python that Debian in madison, while the latest version of python 2 at the date is the one you pointed out:



    ➜ ~ apt-cache policy python
    python:
    Installed: 2.7.5-5
    Candidate: 2.7.5-5
    Version table:
    *** 2.7.5-5 0
    500 http://ftp.us.debian.org/debian/ testing/main i386 Packages
    100 /var/lib/dpkg/status


    (pythonbrew is not longer maintained).






    share|improve this answer

























    • ok I installed pip and virtualenv as root, so how can I create a virtual environment with a new Python version ? as far as I know we need the new version to be installed first right ?

      – Pierre
      Jan 19 '14 at 16:27






    • 1





      @Peter I think that the first step is pyenv install 2.7.6. You can check all versions using pyenv install -l

      – Braiam
      Jan 19 '14 at 16:57
















    16














    You probably are looking for virtualenv or pyenv or some other non-system-wide method to install Python. The method using APT (Advance Package Tool) and dpkg, ensures that all parts of the system are working in harmony, so you maybe want to install python in a separated path, hidden of all the other programs that you can call at will, which is the purpose of pyenv/virtualenv. This answers how to install the latest version of python without breaking the system.



    BTW, you can check out the latest version of python that Debian in madison, while the latest version of python 2 at the date is the one you pointed out:



    ➜ ~ apt-cache policy python
    python:
    Installed: 2.7.5-5
    Candidate: 2.7.5-5
    Version table:
    *** 2.7.5-5 0
    500 http://ftp.us.debian.org/debian/ testing/main i386 Packages
    100 /var/lib/dpkg/status


    (pythonbrew is not longer maintained).






    share|improve this answer

























    • ok I installed pip and virtualenv as root, so how can I create a virtual environment with a new Python version ? as far as I know we need the new version to be installed first right ?

      – Pierre
      Jan 19 '14 at 16:27






    • 1





      @Peter I think that the first step is pyenv install 2.7.6. You can check all versions using pyenv install -l

      – Braiam
      Jan 19 '14 at 16:57














    16












    16








    16







    You probably are looking for virtualenv or pyenv or some other non-system-wide method to install Python. The method using APT (Advance Package Tool) and dpkg, ensures that all parts of the system are working in harmony, so you maybe want to install python in a separated path, hidden of all the other programs that you can call at will, which is the purpose of pyenv/virtualenv. This answers how to install the latest version of python without breaking the system.



    BTW, you can check out the latest version of python that Debian in madison, while the latest version of python 2 at the date is the one you pointed out:



    ➜ ~ apt-cache policy python
    python:
    Installed: 2.7.5-5
    Candidate: 2.7.5-5
    Version table:
    *** 2.7.5-5 0
    500 http://ftp.us.debian.org/debian/ testing/main i386 Packages
    100 /var/lib/dpkg/status


    (pythonbrew is not longer maintained).






    share|improve this answer















    You probably are looking for virtualenv or pyenv or some other non-system-wide method to install Python. The method using APT (Advance Package Tool) and dpkg, ensures that all parts of the system are working in harmony, so you maybe want to install python in a separated path, hidden of all the other programs that you can call at will, which is the purpose of pyenv/virtualenv. This answers how to install the latest version of python without breaking the system.



    BTW, you can check out the latest version of python that Debian in madison, while the latest version of python 2 at the date is the one you pointed out:



    ➜ ~ apt-cache policy python
    python:
    Installed: 2.7.5-5
    Candidate: 2.7.5-5
    Version table:
    *** 2.7.5-5 0
    500 http://ftp.us.debian.org/debian/ testing/main i386 Packages
    100 /var/lib/dpkg/status


    (pythonbrew is not longer maintained).







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Sep 12 '18 at 11:10

























    answered Jan 19 '14 at 15:20









    BraiamBraiam

    23.9k2078144




    23.9k2078144












    • ok I installed pip and virtualenv as root, so how can I create a virtual environment with a new Python version ? as far as I know we need the new version to be installed first right ?

      – Pierre
      Jan 19 '14 at 16:27






    • 1





      @Peter I think that the first step is pyenv install 2.7.6. You can check all versions using pyenv install -l

      – Braiam
      Jan 19 '14 at 16:57


















    • ok I installed pip and virtualenv as root, so how can I create a virtual environment with a new Python version ? as far as I know we need the new version to be installed first right ?

      – Pierre
      Jan 19 '14 at 16:27






    • 1





      @Peter I think that the first step is pyenv install 2.7.6. You can check all versions using pyenv install -l

      – Braiam
      Jan 19 '14 at 16:57

















    ok I installed pip and virtualenv as root, so how can I create a virtual environment with a new Python version ? as far as I know we need the new version to be installed first right ?

    – Pierre
    Jan 19 '14 at 16:27





    ok I installed pip and virtualenv as root, so how can I create a virtual environment with a new Python version ? as far as I know we need the new version to be installed first right ?

    – Pierre
    Jan 19 '14 at 16:27




    1




    1





    @Peter I think that the first step is pyenv install 2.7.6. You can check all versions using pyenv install -l

    – Braiam
    Jan 19 '14 at 16:57






    @Peter I think that the first step is pyenv install 2.7.6. You can check all versions using pyenv install -l

    – Braiam
    Jan 19 '14 at 16:57














    27














    Ok after a lot of searching I decided to build Python from source, so I downloaded the compressed source tarball from the Python download page, now we need to install the build-essential package to be able to compile the source files:



    apt-get install build-essential


    also we need to install these development packages which are required for some Python modules:



    libbz2-dev
    libsqlite3-dev
    libreadline-dev
    zlib1g-dev
    libncurses5-dev
    libssl-dev
    libgdbm-dev


    next we extract the downloaded source file:



    tar zxf Python-2.7.6.tgz


    then we cd into the extracted directory:



    cd Python-2.7.6


    and follow the instructions on the Python docs:



    ./configure --prefix=/opt/python
    make
    make install # <- in the docs but don't execute: use checkinstall


    I chose to install it under the directory /opt/python which I created before, also I used the checkinstall package to create a .deb file so I can uninstall easily later, so we install it first:



    apt-get install checkinstall


    and substitute the last line make install with:



    checkinstall


    now I have a new python installation in /opt/python/lib/python2.7 and the binary file is in /opt/python/bin/python2.7.



    now I can run in the command line /opt/python/bin/python2.7 to use this Python version, also we can make a link to this executable so we don't type the full path, I named it python2.7.6.



    ln -s /opt/python/bin/python2.7 /usr/local/bin/python2.7.6


    also the directory /opt/python/bin will contain later other executables like pip and virtualenv or any other modules you install so we can add it to the PATH environment variable, edit ~/.profile and add this line:



    PATH="$PATH:/opt/python/bin"


    and run:



    source ~/.profile


    I appended the path to the end because it contains executable names like the ones in /usr/bin like python, python2 and python2.7 so we keep the higher priority for /usr/bin.






    share|improve this answer

























    • Now, would you happen to know how to configure your new python to see modules that were installed via apt-get?

      – elsurudo
      Jan 27 '16 at 21:22











    • Unfortunately for Python 2.6, compiling from source doesn't work properly on Debian 8 (Jessie) but I found, at least for a Raspberry Pi, that I was able to use older packages from packages.debian.org. The order, assuming build-essentials are already in place is something like libdb, python2.6-minimal, python2.6, libpython2.6, python2-6-dev but dpkg -i will tell you what's needed.

      – Charlie Clark
      Apr 14 '16 at 10:29






    • 1





      @elsurudo That would not make sense really, because the modules might well be unsupported on your new version. If you want full control over your Python (as you do when compiling from source), you will want to install modules separately, too.

      – tripleee
      Oct 20 '16 at 8:01















    27














    Ok after a lot of searching I decided to build Python from source, so I downloaded the compressed source tarball from the Python download page, now we need to install the build-essential package to be able to compile the source files:



    apt-get install build-essential


    also we need to install these development packages which are required for some Python modules:



    libbz2-dev
    libsqlite3-dev
    libreadline-dev
    zlib1g-dev
    libncurses5-dev
    libssl-dev
    libgdbm-dev


    next we extract the downloaded source file:



    tar zxf Python-2.7.6.tgz


    then we cd into the extracted directory:



    cd Python-2.7.6


    and follow the instructions on the Python docs:



    ./configure --prefix=/opt/python
    make
    make install # <- in the docs but don't execute: use checkinstall


    I chose to install it under the directory /opt/python which I created before, also I used the checkinstall package to create a .deb file so I can uninstall easily later, so we install it first:



    apt-get install checkinstall


    and substitute the last line make install with:



    checkinstall


    now I have a new python installation in /opt/python/lib/python2.7 and the binary file is in /opt/python/bin/python2.7.



    now I can run in the command line /opt/python/bin/python2.7 to use this Python version, also we can make a link to this executable so we don't type the full path, I named it python2.7.6.



    ln -s /opt/python/bin/python2.7 /usr/local/bin/python2.7.6


    also the directory /opt/python/bin will contain later other executables like pip and virtualenv or any other modules you install so we can add it to the PATH environment variable, edit ~/.profile and add this line:



    PATH="$PATH:/opt/python/bin"


    and run:



    source ~/.profile


    I appended the path to the end because it contains executable names like the ones in /usr/bin like python, python2 and python2.7 so we keep the higher priority for /usr/bin.






    share|improve this answer

























    • Now, would you happen to know how to configure your new python to see modules that were installed via apt-get?

      – elsurudo
      Jan 27 '16 at 21:22











    • Unfortunately for Python 2.6, compiling from source doesn't work properly on Debian 8 (Jessie) but I found, at least for a Raspberry Pi, that I was able to use older packages from packages.debian.org. The order, assuming build-essentials are already in place is something like libdb, python2.6-minimal, python2.6, libpython2.6, python2-6-dev but dpkg -i will tell you what's needed.

      – Charlie Clark
      Apr 14 '16 at 10:29






    • 1





      @elsurudo That would not make sense really, because the modules might well be unsupported on your new version. If you want full control over your Python (as you do when compiling from source), you will want to install modules separately, too.

      – tripleee
      Oct 20 '16 at 8:01













    27












    27








    27







    Ok after a lot of searching I decided to build Python from source, so I downloaded the compressed source tarball from the Python download page, now we need to install the build-essential package to be able to compile the source files:



    apt-get install build-essential


    also we need to install these development packages which are required for some Python modules:



    libbz2-dev
    libsqlite3-dev
    libreadline-dev
    zlib1g-dev
    libncurses5-dev
    libssl-dev
    libgdbm-dev


    next we extract the downloaded source file:



    tar zxf Python-2.7.6.tgz


    then we cd into the extracted directory:



    cd Python-2.7.6


    and follow the instructions on the Python docs:



    ./configure --prefix=/opt/python
    make
    make install # <- in the docs but don't execute: use checkinstall


    I chose to install it under the directory /opt/python which I created before, also I used the checkinstall package to create a .deb file so I can uninstall easily later, so we install it first:



    apt-get install checkinstall


    and substitute the last line make install with:



    checkinstall


    now I have a new python installation in /opt/python/lib/python2.7 and the binary file is in /opt/python/bin/python2.7.



    now I can run in the command line /opt/python/bin/python2.7 to use this Python version, also we can make a link to this executable so we don't type the full path, I named it python2.7.6.



    ln -s /opt/python/bin/python2.7 /usr/local/bin/python2.7.6


    also the directory /opt/python/bin will contain later other executables like pip and virtualenv or any other modules you install so we can add it to the PATH environment variable, edit ~/.profile and add this line:



    PATH="$PATH:/opt/python/bin"


    and run:



    source ~/.profile


    I appended the path to the end because it contains executable names like the ones in /usr/bin like python, python2 and python2.7 so we keep the higher priority for /usr/bin.






    share|improve this answer















    Ok after a lot of searching I decided to build Python from source, so I downloaded the compressed source tarball from the Python download page, now we need to install the build-essential package to be able to compile the source files:



    apt-get install build-essential


    also we need to install these development packages which are required for some Python modules:



    libbz2-dev
    libsqlite3-dev
    libreadline-dev
    zlib1g-dev
    libncurses5-dev
    libssl-dev
    libgdbm-dev


    next we extract the downloaded source file:



    tar zxf Python-2.7.6.tgz


    then we cd into the extracted directory:



    cd Python-2.7.6


    and follow the instructions on the Python docs:



    ./configure --prefix=/opt/python
    make
    make install # <- in the docs but don't execute: use checkinstall


    I chose to install it under the directory /opt/python which I created before, also I used the checkinstall package to create a .deb file so I can uninstall easily later, so we install it first:



    apt-get install checkinstall


    and substitute the last line make install with:



    checkinstall


    now I have a new python installation in /opt/python/lib/python2.7 and the binary file is in /opt/python/bin/python2.7.



    now I can run in the command line /opt/python/bin/python2.7 to use this Python version, also we can make a link to this executable so we don't type the full path, I named it python2.7.6.



    ln -s /opt/python/bin/python2.7 /usr/local/bin/python2.7.6


    also the directory /opt/python/bin will contain later other executables like pip and virtualenv or any other modules you install so we can add it to the PATH environment variable, edit ~/.profile and add this line:



    PATH="$PATH:/opt/python/bin"


    and run:



    source ~/.profile


    I appended the path to the end because it contains executable names like the ones in /usr/bin like python, python2 and python2.7 so we keep the higher priority for /usr/bin.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jul 11 '15 at 9:40









    Make42

    2411212




    2411212










    answered Jan 20 '14 at 19:30









    PierrePierre

    6564918




    6564918












    • Now, would you happen to know how to configure your new python to see modules that were installed via apt-get?

      – elsurudo
      Jan 27 '16 at 21:22











    • Unfortunately for Python 2.6, compiling from source doesn't work properly on Debian 8 (Jessie) but I found, at least for a Raspberry Pi, that I was able to use older packages from packages.debian.org. The order, assuming build-essentials are already in place is something like libdb, python2.6-minimal, python2.6, libpython2.6, python2-6-dev but dpkg -i will tell you what's needed.

      – Charlie Clark
      Apr 14 '16 at 10:29






    • 1





      @elsurudo That would not make sense really, because the modules might well be unsupported on your new version. If you want full control over your Python (as you do when compiling from source), you will want to install modules separately, too.

      – tripleee
      Oct 20 '16 at 8:01

















    • Now, would you happen to know how to configure your new python to see modules that were installed via apt-get?

      – elsurudo
      Jan 27 '16 at 21:22











    • Unfortunately for Python 2.6, compiling from source doesn't work properly on Debian 8 (Jessie) but I found, at least for a Raspberry Pi, that I was able to use older packages from packages.debian.org. The order, assuming build-essentials are already in place is something like libdb, python2.6-minimal, python2.6, libpython2.6, python2-6-dev but dpkg -i will tell you what's needed.

      – Charlie Clark
      Apr 14 '16 at 10:29






    • 1





      @elsurudo That would not make sense really, because the modules might well be unsupported on your new version. If you want full control over your Python (as you do when compiling from source), you will want to install modules separately, too.

      – tripleee
      Oct 20 '16 at 8:01
















    Now, would you happen to know how to configure your new python to see modules that were installed via apt-get?

    – elsurudo
    Jan 27 '16 at 21:22





    Now, would you happen to know how to configure your new python to see modules that were installed via apt-get?

    – elsurudo
    Jan 27 '16 at 21:22













    Unfortunately for Python 2.6, compiling from source doesn't work properly on Debian 8 (Jessie) but I found, at least for a Raspberry Pi, that I was able to use older packages from packages.debian.org. The order, assuming build-essentials are already in place is something like libdb, python2.6-minimal, python2.6, libpython2.6, python2-6-dev but dpkg -i will tell you what's needed.

    – Charlie Clark
    Apr 14 '16 at 10:29





    Unfortunately for Python 2.6, compiling from source doesn't work properly on Debian 8 (Jessie) but I found, at least for a Raspberry Pi, that I was able to use older packages from packages.debian.org. The order, assuming build-essentials are already in place is something like libdb, python2.6-minimal, python2.6, libpython2.6, python2-6-dev but dpkg -i will tell you what's needed.

    – Charlie Clark
    Apr 14 '16 at 10:29




    1




    1





    @elsurudo That would not make sense really, because the modules might well be unsupported on your new version. If you want full control over your Python (as you do when compiling from source), you will want to install modules separately, too.

    – tripleee
    Oct 20 '16 at 8:01





    @elsurudo That would not make sense really, because the modules might well be unsupported on your new version. If you want full control over your Python (as you do when compiling from source), you will want to install modules separately, too.

    – tripleee
    Oct 20 '16 at 8:01











    -1














    you can use:



    aptitude install python3.5 


    or, if you haven't installed aptitude, then you can install it using:



    apt-get install aptitude





    share|improve this answer





























      -1














      you can use:



      aptitude install python3.5 


      or, if you haven't installed aptitude, then you can install it using:



      apt-get install aptitude





      share|improve this answer



























        -1












        -1








        -1







        you can use:



        aptitude install python3.5 


        or, if you haven't installed aptitude, then you can install it using:



        apt-get install aptitude





        share|improve this answer















        you can use:



        aptitude install python3.5 


        or, if you haven't installed aptitude, then you can install it using:



        apt-get install aptitude






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Sep 19 '16 at 14:19









        Jeff Schaller

        45.1k1164147




        45.1k1164147










        answered Sep 19 '16 at 13:44









        johnjohn

        9




        9





















            -1














            I had the same question, I tried sudo apt-get install python3 and it worked.



            $ ls /usr/bin/python*
            /usr/bin/python /usr/bin/python3 /usr/bin/python3m
            /usr/bin/python2 /usr/bin/python3.4
            /usr/bin/python2.7 /usr/bin/python3.4m






            share|improve this answer




















            • 2





              This is not working for debian, maybe for ubuntu or others...

              – piertoni
              Nov 18 '15 at 14:33











            • @piertoni It does work on many versions of Debian. In fact, you would have to be stuck on a release which is far out of support in order for this not to work.

              – tripleee
              Oct 20 '16 at 8:02















            -1














            I had the same question, I tried sudo apt-get install python3 and it worked.



            $ ls /usr/bin/python*
            /usr/bin/python /usr/bin/python3 /usr/bin/python3m
            /usr/bin/python2 /usr/bin/python3.4
            /usr/bin/python2.7 /usr/bin/python3.4m






            share|improve this answer




















            • 2





              This is not working for debian, maybe for ubuntu or others...

              – piertoni
              Nov 18 '15 at 14:33











            • @piertoni It does work on many versions of Debian. In fact, you would have to be stuck on a release which is far out of support in order for this not to work.

              – tripleee
              Oct 20 '16 at 8:02













            -1












            -1








            -1







            I had the same question, I tried sudo apt-get install python3 and it worked.



            $ ls /usr/bin/python*
            /usr/bin/python /usr/bin/python3 /usr/bin/python3m
            /usr/bin/python2 /usr/bin/python3.4
            /usr/bin/python2.7 /usr/bin/python3.4m






            share|improve this answer















            I had the same question, I tried sudo apt-get install python3 and it worked.



            $ ls /usr/bin/python*
            /usr/bin/python /usr/bin/python3 /usr/bin/python3m
            /usr/bin/python2 /usr/bin/python3.4
            /usr/bin/python2.7 /usr/bin/python3.4m







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 22 hours ago









            Rui F Ribeiro

            42.2k1484142




            42.2k1484142










            answered Jul 11 '15 at 10:50









            san1512san1512

            295139




            295139







            • 2





              This is not working for debian, maybe for ubuntu or others...

              – piertoni
              Nov 18 '15 at 14:33











            • @piertoni It does work on many versions of Debian. In fact, you would have to be stuck on a release which is far out of support in order for this not to work.

              – tripleee
              Oct 20 '16 at 8:02












            • 2





              This is not working for debian, maybe for ubuntu or others...

              – piertoni
              Nov 18 '15 at 14:33











            • @piertoni It does work on many versions of Debian. In fact, you would have to be stuck on a release which is far out of support in order for this not to work.

              – tripleee
              Oct 20 '16 at 8:02







            2




            2





            This is not working for debian, maybe for ubuntu or others...

            – piertoni
            Nov 18 '15 at 14:33





            This is not working for debian, maybe for ubuntu or others...

            – piertoni
            Nov 18 '15 at 14:33













            @piertoni It does work on many versions of Debian. In fact, you would have to be stuck on a release which is far out of support in order for this not to work.

            – tripleee
            Oct 20 '16 at 8:02





            @piertoni It does work on many versions of Debian. In fact, you would have to be stuck on a release which is far out of support in order for this not to work.

            – tripleee
            Oct 20 '16 at 8:02

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f110014%2fhow-to-install-the-latest-python-version-on-debian-separately-or-upgrade%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            -debian, package-management, python

            Popular posts from this blog

            Mobil Contents History Mobil brands Former Mobil brands Lukoil transaction Mobil UK Mobil Australia Mobil New Zealand Mobil Greece Mobil in Japan Mobil in Canada Mobil Egypt See also References External links Navigation menuwww.mobil.com"Mobil Corporation"the original"Our Houston campus""Business & Finance: Socony-Vacuum Corp.""Popular Mechanics""Lubrite Technologies""Exxon Mobil campus 'clearly happening'""Toledo Blade - Google News Archive Search""The Lion and the Moose - How 2 Executives Pulled off the Biggest Merger Ever""ExxonMobil Press Release""Lubricants""Archived copy"the original"Mobil 1™ and Mobil Super™ motor oil and synthetic motor oil - Mobil™ Motor Oils""Mobil Delvac""Mobil Industrial website""The State of Competition in Gasoline Marketing: The Effects of Refiner Operations at Retail""Mobil Travel Guide to become Forbes Travel Guide""Hotel Rankings: Forbes Merges with Mobil"the original"Jamieson oil industry history""Mobil news""Caltex pumps for control""Watchdog blocks Caltex bid""Exxon Mobil sells service station network""Mobil Oil New Zealand Limited is New Zealand's oldest oil company, with predecessor companies having first established a presence in the country in 1896""ExxonMobil subsidiaries have a business history in New Zealand stretching back more than 120 years. We are involved in petroleum refining and distribution and the marketing of fuels, lubricants and chemical products""Archived copy"the original"Exxon Mobil to Sell Its Japanese Arm for $3.9 Billion""Gas station merger will end Esso and Mobil's long run in Japan""Esso moves to affiliate itself with PC Optimum, no longer Aeroplan, in loyalty point switch""Mobil brand of gas stations to launch in Canada after deal for 213 Loblaws-owned locations""Mobil Nears Completion of Rebranding 200 Loblaw Gas Stations""Learn about ExxonMobil's operations in Egypt""Petrol and Diesel Service Stations in Egypt - Mobil"Official websiteExxon Mobil corporate websiteMobil Industrial official websiteeeeeeeeDA04275022275790-40000 0001 0860 5061n82045453134887257134887257

            Frič See also Navigation menuinternal link

            Identify plant with long narrow paired leaves and reddish stems Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant