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;
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
add a comment |
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
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
add a comment |
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
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
debian package-management python
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
add a comment |
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
add a comment |
4 Answers
4
active
oldest
votes
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).
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 ispyenv install 2.7.6
. You can check all versions usingpyenv install -l
– Braiam
Jan 19 '14 at 16:57
add a comment |
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
.
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 butdpkg -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
add a comment |
you can use:
aptitude install python3.5
or, if you haven't installed aptitude, then you can install it using:
apt-get install aptitude
add a comment |
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
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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).
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 ispyenv install 2.7.6
. You can check all versions usingpyenv install -l
– Braiam
Jan 19 '14 at 16:57
add a comment |
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).
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 ispyenv install 2.7.6
. You can check all versions usingpyenv install -l
– Braiam
Jan 19 '14 at 16:57
add a comment |
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).
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).
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 ispyenv install 2.7.6
. You can check all versions usingpyenv install -l
– Braiam
Jan 19 '14 at 16:57
add a comment |
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 ispyenv install 2.7.6
. You can check all versions usingpyenv 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
add a comment |
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
.
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 butdpkg -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
add a comment |
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
.
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 butdpkg -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
add a comment |
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
.
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
.
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 butdpkg -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
add a comment |
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 butdpkg -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
add a comment |
you can use:
aptitude install python3.5
or, if you haven't installed aptitude, then you can install it using:
apt-get install aptitude
add a comment |
you can use:
aptitude install python3.5
or, if you haven't installed aptitude, then you can install it using:
apt-get install aptitude
add a comment |
you can use:
aptitude install python3.5
or, if you haven't installed aptitude, then you can install it using:
apt-get install aptitude
you can use:
aptitude install python3.5
or, if you haven't installed aptitude, then you can install it using:
apt-get install aptitude
edited Sep 19 '16 at 14:19
Jeff Schaller♦
45.1k1164147
45.1k1164147
answered Sep 19 '16 at 13:44
johnjohn
9
9
add a comment |
add a comment |
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
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
add a comment |
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
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
add a comment |
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
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
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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