user2234826
user2234826

Reputation: 21

Errors in my Django install

I'm a beginner to Django so please excuse my ignorance here. I am trying to manually install Django so that I can start working with it. I've already installed Python successfully and downloaded Django to my Mac.

When I run the command "sudo python setup.py install" in the Django-1.5.1 directory, I get the following response:

/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory

Can anyone help me understand why this isn't running correctly and what I can do to fix it?

Thanks,

Ryan

Upvotes: 0

Views: 165

Answers (2)

user2234846
user2234846

Reputation: 46

As Nathan said pip or easy_install is the best way to install packages. But you need to make sure you have pip installed first:

sudo easy_install pip
sudo pip install django

If you need to specify your version of Django you can do it this way:

sudo pip install django==1.5.1

But normally it's better not to install packages globally (with sudo) and instead it's better to use virtual environments:

sudo easy_install pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper

source /usr/local/bin/virtualenvwrapper.sh

mkdir myproject
cd myproject
mkvirtualenv --no-site-packages myprojectenv
workon myprojectenv

pip install django

Upvotes: 2

Nathan Villaescusa
Nathan Villaescusa

Reputation: 17659

I would suggest installing it via pip:

sudo pip install django

or easy_install:

sudo easy_install install django

Both methods will use the Python cheeseshop to install the latest version of django.

Take a look at https://docs.djangoproject.com/en/dev/topics/install/#installing-an-official-release-with-pip for more details.

Upvotes: 1

Related Questions