1

Hello I'm getting this error on my mac when i tried installing Django using pip. I created a directory and virtual environment. But ran into this error when attempting to install django.

Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_set.py", line 731, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_install.py", line 841, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_install.py", line 1040, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/wheel.py", line 343, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/wheel.py", line 314, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/utils/__init__.py", line 82, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/django'
3
  • 1
    You haven't activated your virtualemv. Commented Feb 2, 2016 at 22:43
  • @DanielRosemanThanks that was the problem. Im new to python and Django and learning the concepts. Thanks a lot Commented Feb 2, 2016 at 22:50
  • The basic intro to virtual environments: docs.python-guide.org/en/latest/dev/virtualenvs Commented Feb 2, 2016 at 23:51

1 Answer 1

2

Have you activated your virtual environment?

source env/bin/activate

It looks like you are running the default pip and you don't have permission to install into the directory. If you run sudo pip install django it should work.

Sign up to request clarification or add additional context in comments.

1 Comment

yes that was the error not activating my virtual environment. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.