How to install Django on different version of PYTHON? - django

I have two python versions 2.6 and 3.0. I want to install django1.3 in python3.0's site-package directory and my default python setting is on 2.6. I also added path /usr/local/bin/python3.0 and /usr/local/bin/python3.0 into .bashrc file.
Please help me.

Django is not compatible with Python 3. You must install it in the 2.X branch.
However, what you want to achive will be easier done using virtualenv:
easy_install virtualenv
virtualenv project --python=python2.6
source project/bin/activate
pip install django

Django doesn't yet work with python3.0. So it is better you install it on the python2.6 dist-packages folder.
That said, if you had python2.7 and wanted to install django on python 2.7, while the better approach is to use virtualenv, a simple solution is to:
python2.7 setup.py install
or
easy_install2.7 django
or
/path/to/python2.7/dist-packages/pip/pip install django

easy_install virtualenv
pip install django
Sudo pip install django
Seemed to work for me!

by using pip install django --> it installs the latest version of django.
https://technicalforum.wordpress.com/2016/12/17/introduction-to-django/

Related

virtual env python 3.5 only finds django python 2.7

I have created python 3.5.2 virtual environment ("python --version" confirms that)
but when i try to install django using "pip install django~=1.10.0" I get this message:
Requirement already satisfied: django~=1.10.0 in /usr/local/lib/python2.7/dist-packages
How can I get django version that agrees with the python version in my venv?
Personally I use conda to manage environments and I'm not really familiar with virtualenv, but a few things to check.
I bet you need to use pip3 not pip (aka pip2) to install django that way it will be installed in your python 3 env.
Probabily you have already installed django outside the venv with python2.
just write see in the pip list if django is installed.
Then uninstall, enter in the venv and reinstall django with python3
Ok - so I figured out what happened. I have installed django using sudo pip install. Even though I was in the venv (created with python3) this has resulted in reference to django outside the venv. Sooo...it was an interesting thing to learn I guess.

I used virtualenv and installed django1.9 . But I need to uninstall 1.9 and install 1.7. How to do that. Tell me whether that is possible?

I used virtualenv and installed django1.9 .But I need to uninstall django1.9 and install django1.7.
How to do that?
Tell me whether that is possible?
In your virtualenv, do the following
pip uninstall Django
pip install django==1.7

Installing django on two existing versions on python

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?
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
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:
install python-virtualenv :
$>sudo apt-get install python-virtualenv # on Ubuntu
create a virtual-env against the Python you want, and activate it
$> virtualenv -p /usr/bin/pythonX ve
$> source ve/bin/activate
install django into this virtual-env
$> pip install django
...
PROFIT!

pip install django-adaptors overwriting 1.5 version of Django

When I install django-adaptors using pip install django-adaptors it also seems to install django 1.4 in the process, which overwrites my django 1.5 installation.
How can I install django-adaptors without it overwriting my version of Django?
Thanks
pip install django-adaptors --no-deps
It's an issue with the packages setup.py. You can see the source here: https://raw.github.com/anthony-tresontani/django-adaptors/master/setup.py
It defines 'Django==1.4' rather than 'Django>=1.4' so it will install Django 1.4 therefore overriding your 1.5 install.
All I can suggest is alter your requirements.txt so django-adaptors is above Django==1.5 so when pip installs 1.5 would be installed after django-adaptors has installed 1.4.
You could simply run pip install django -U after having installed django-adaptors. That will give you django-adaptors, all its dependencies and django 1.5. You could also simply download django-adaptors and change its dependencies file.
The advantage of this approach is that it is easily repeatable when you are moving to a production server (for instance in a fabric script).
One caveat, though: read the django 1.5 release notes to know whether you are likely to encounter any problems.
I just uploaded django-adaptors 0.2.4 which integrate Andrew Ingram fix that that.
You, then, just have to do again:
pip install django-adaptors

Uninstalling old version Django for upgrade to latest version

I want to upgrade Django from 1.2.5 to 1.3. I uninstalled 1.2.5 version, by the Ubuntu Software Center, for future upgrading, but it still in dist-packages and it still imported in python shell. What should I do? Would it be normal if I would brutally deleted the folder and egg from dist-packages?
It runs on Ubuntu 10.04
I recommend using setup-tools. Then run
easy_install --upgrade django
It will remove current django path from PYTHON_PATH and will add it's own path. To get easy_install do:
apt-get install python-setuptools
For both actions sudo is needed.
Go to the /usr/local/lib/python2.6/dist-packages. Find django folder there and delete it. then download django 1.3 and run python setup.py install. This should do the trick.
Remove django version using pip:
pip uninstall django
And install the version you want, for example 1.5:
pip install django==1.5