Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing second python on Debian

So I have Debian machine for my Django production server. I need to install second python (2.7.1) to use with virtualenv. But it always write I don't have some modules, then I have to search manually, apt-install them and rebuild. Is there either a way to resolve the dependencies for building, or pre-compiled .deb with python 2.7.1 for Debian Squeeze? Sorry if this is much of a noobie question, I googled, honestly.

like image 333
creitve Avatar asked May 06 '11 05:05

creitve


People also ask

Can I install 2 Python versions?

If you wish to use multiple versions of Python on a single machine, then pyenv is a commonly used tool to install and switch between versions. This is not to be confused with the previously mentioned depreciated pyvenv script. It does not come bundled with Python and must be installed separately.

Can I install both Python 2 and 3?

Answer: Yes, we can install both Python 2 and Python 3. We can easily maintain separate environments for Python 2 programs and Python 3 programs on the same computer and not worry about the programs interacting with each other.


2 Answers

Get the Python 2.7.1 sources and compile it manually:

configure --prefix=/path/to/python-2.7
make; make install
like image 99
Andreas Jung Avatar answered Oct 15 '22 09:10

Andreas Jung


Python 2.7 is available for wheezy (testing), so you should be able to install it by adding the testing repository and doing some APT pinning.

1) add the repository in /etc/apt/sources.list

deb http://ftp.us.debian.org/debian testing main contrib non-free

2) do the actual pinning in /etc/apt/preferences

Package: *
Pin: release n=testing
Pin-Priority: 100

A Pin-Priority of under 500 basically means that no packages from testing are installed automatically, so you won't have problems with other packages.

3) install python2.7 from testing:

aptitude -t testing install python2.7

(or apt-get if you don't have aptitude)

like image 36
StackExchange saddens dancek Avatar answered Oct 15 '22 10:10

StackExchange saddens dancek