-
-
Save lukaslundgren/2659457 to your computer and use it in GitHub Desktop.
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev | |
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz | |
tar -xzf Python-2.7.3.tgz | |
cd Python-2.7.3 | |
./configure --prefix=/usr --enable-shared | |
make | |
sudo make install | |
cd .. | |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 20 | |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10 | |
sudo update-alternatives --set python /usr/bin/python2.6 | |
wget http://peak.telecommunity.com/dist/ez_setup.py | |
sudo python2.7 ez_setup.py | |
sudo easy_install-2.7 virtualenv | |
@chenaren I believe it's because of all of the other software that depends on 2.6
--no-check-certificate is required on the first wget
This is not a good way to install Python on Debian. Chances are Python is already installed. The current stable release (Wheezy) comes with packages for "python2.7" and "python2.6".
On line 7 "--prefix=/usr" means "write over the files managed by my Debian packages". This is definitely something that apt tools will complain about, and next time the Python packages are updated the manually installed versions will be overwritten. /usr/local is where custom compiled software belongs on a Debian system.
If you're trying to get Python working in Debian, try the official Debian packages from the repositories first. The above method is bound to break something, if not now then at update time.
I agree with deptadapt only for version 2.7.3 because that is the release available to Debian. I would definitely install it in a different directory, so you don't overwrite the distribution's package contents (You will start seeing lots of errors!). See here for ideas on installing multiple versions: http://www.extellisys.com/articles/python-on-debian-wheezy
However, this was useful to me for setting up 2.7.8, which is the current version available from Python.org.
Also, check out "virtualenvwrapper" for your virtualenv setups, as it has a few extra features (http://virtualenvwrapper.readthedocs.org/en/latest/). Note, you still need to install virtualenv first.
Hello again. I would like to ask that you remove this gist because it is profoundly bad advice for a Debian system.
Software installed locally should go to /usr/local. Only software installed by the package manager should live in /usr. The instructions here will conflict with upgrades from the package manager and leave the system in a broken state.
Please consider removing or correcting this gist. This is the second time I've encountered someone on IRC who has broken their Debian system following these instructions.
I get all this crap appearing:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python is already the newest version.
python set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
8 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up python2.7-minimal (2.7.3-6+deb7u3) ...
Linking and byte-compiling packages for runtime python2.7...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in
from debpython.version import SUPPORTED, debsorted, vrepr,
ImportError: No module named debpython.version
dpkg: error processing python2.7-minimal (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-minimal:
python-minimal depends on python2.7-minimal (>= 2.7.3-1~); however:
Package python2.7-minimal is not configured yet.
dpkg: error processing python-minimal (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python2.7:
python2.7 depends on python2.7-minimal (= 2.7.3-6+deb7u3); however:
Package python2.7-minimal is not configured yet.
dpkg: error processing python2.7 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python:
python depends on python2.7 (>= 2.7.3-1~); however:
Package python2.7 is not configured yet.
python depends on python-minimal (= 2.7.3-4+deb7u1); however:
Package python-minimal is not configured yet.
dpkg: error processing python (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-cheetah:
python-cheetah depends on python2.7; however:
Package python2.7 is not configured yet.
python-cheetah depends on python (>= 2.6.6-7~); however:
Package python is not configured yet.
python-cheetah depends on python (<< 2.8); however:
Package python is not configured yet.
dpkg: error processing python-cheetah (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-configobj:
python-configobj depends on python2.7 | python2.6; however:
Package python2.7 is not configured yet.
Package python2.6 is not installed.
python-configobj depends on python (>= 2.6.6-7~); however:
Package python is not configured yet.
python-configobj depends on python (<< 2.8); however:
Package python is not configured yet.
dpkg: error processing python-configobj (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-feedparser:
python-feedparser depends on python2.7 | python2.6; however:
Package python2.7 is not configured yet.
Package python2.6 is not installed.
python-feedparser depends on python (>= 2.6.6-7~); however:
Package python is not configured yet.
python-feedparser depends on python (<< 2.8); however:
Package python is not configured yet.
dpkg: error processing python-feedparser (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-pkg-resources:
python-pkg-resources depends on python (>= 2.6); however:
Package python is not configured yet.
python-pkg-resources depends on python (<< 2.8); however:
Package python is not configured yet.
dpkg: error processing python-pkg-resources (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python2.7-minimal
python-minimal
python2.7
python
python-cheetah
python-configobj
python-feedparser
python-pkg-resources
E: Sub-process /usr/bin/dpkg returned an error code (1)
Just an update:
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline-gplv2-dev libssl-dev libdb-dev tk-dev
On jesse libreadline5-dev
is now libreadline-gplv2-dev
. Also install tk-dev to make sure you get tkinker sys library.
Thanks for this simple but lifesaving workflow! I was stupid enough to manually uninstall python2.7 but was able to recover it using this, saving me from the pain of completely setting up my system anew :).
@veralaub
I did the same mistake!
Thanks for sharing!
@wassname Package 'libreadline-gplv2-dev' has no installation candidate in Debian 12
@bektigalan
Found the answer here:
https://jira.mariadb.org/browse/MDEV-24798
replacing Package 'libreadline-gplv2-dev' with 'libeditreadline-dev' fixed the issue for me.
@bektigalan Found the answer here: https://jira.mariadb.org/browse/MDEV-24798
replacing Package 'libreadline-gplv2-dev' with 'libeditreadline-dev' fixed the issue for me.
thanks a lot @vanjy-eng i already solved it by downgrade my machine to debian 11, not exactly neat solution but saved me from headache
why higher priority for python 2.6?