3

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)

Glyn Jackson
  • 8,228
  • 4
  • 29
  • 52
Steven Rogers
  • 1,874
  • 5
  • 25
  • 48
  • 3
    Mac can be a pain, you will have to change the default version it uses. However, forget all that and use virtualenv! It will save your life. Virtualenv creates a Python environment that is segregated from your system wide Python installation. – Glyn Jackson Nov 15 '13 at 22:55

2 Answers2

2

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.

Xuan
  • 5,255
  • 1
  • 34
  • 30
1

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

Community
  • 1
  • 1
juliocesar
  • 5,706
  • 8
  • 44
  • 63