0

I have both python 2.7 and 3.2 installed on my computer and I wanted to install django. And when I did it automatically installed django 1.4 on python 3. Is there a way I can install it on python 2.7?

4

2 回答 2

2

You can mention explicitly the python version while installing.

First download the source from django website.

Now extract it to any location and open the terminal and go to the location into the folder. There must be a file named setup.py that is the installation file.Now type:

For Python 3.2

python3.2 setup.py install 

For Python 2.7

python2.7 setup.py install
于 2013-04-30T04:58:31.053 回答
1

The real answer here is that you should be using virtual environments, as they both solve this particular problem, and are the industry standard because they solve many problems.

Simple process:

  1. install python-virtualenv :

    $>sudo apt-get install python-virtualenv # on Ubuntu

  2. create a virtual-env against the Python you want, and activate it

    $> virtualenv -p /usr/bin/pythonX ve

    $> source ve/bin/activate

  3. install django into this virtual-env

    $> pip install django

...

PROFIT!

于 2014-07-14T13:19:33.963 回答