Steven Rogers
Steven Rogers

Reputation: 2004

Django is installing to the wrong python version

I had python 2.6 and I downloaded Django. I found that python 2.6 throws errors when trying to run django, so I downloaded python 2.7. Now, typing python in the terminal runs 2.7 but the django library isn't in the 2.7 folder. So I uninstalled django using:

sudo pip uninstall django

and that worked just fine. When i used the command:

sudo pip install django

it installed into the python 2.6 instead of python 2.7.

How can I install django into python 2.7 instead of python 2.6?

(I am running a MacBook Pro on 1.6, and I was told to not uninstall the base version of python because so many of the systems use 2.6)

Upvotes: 3

Views: 1248

Answers (2)

juliocesar
juliocesar

Reputation: 5876

The problem is that you are running pip from your default Python installation (2.6), read this: How to run multiple python version on Windows, maybe answers give you how to solve in your OS X.

You can view the version of your default Python installation by executing python -V, there is a way to specify which version to use when you execute python, in Linux you can create an alias (alias python=python2.7) in your $HOME/.bash_profile, OS X must have something similar, then install pip using your preferred version.

BTW, It's recommended to use virtualenv

Upvotes: 1

Xuan
Xuan

Reputation: 5629

You need to install pip for python2.7. If it's installed, you should be able to see it using which pip-2.7.

It's better not to touch system python. Use homebrew to install your own.

Upvotes: 2

Related Questions