-2
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/usr/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/local/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/django'

How can I install Django?!?!?!

Håken Lid
  • 22,318
  • 9
  • 52
  • 67
Daekuen Nam
  • 21
  • 1
  • 3
  • 1
    Don't just copy your error log. Describe the problem, state what you have done and what was expected. – hrust Aug 28 '17 at 08:47
  • `Permission denied` do you have write access to that directory? I believe you need root privileges to install django – hrust Aug 28 '17 at 08:48
  • 3
    Possible duplicate of [pip install -r: OSError: \[Errno 13\] Permission denied](https://stackoverflow.com/questions/31512422/pip-install-r-oserror-errno-13-permission-denied) – Brown Bear Aug 28 '17 at 08:50
  • For the record, you don't need root to install Django – airstrike Aug 28 '17 at 08:56
  • You should check out a django tutorial. It's highly recommended to install django in a virtual environment. Here's a step-by-step guide. https://tutorial.djangogirls.org/en/django_installation/ – Håken Lid Aug 28 '17 at 08:56

4 Answers4

2

Install it either by:

sudo pip install django or like how @Y0da suggested.

afagarap
  • 650
  • 2
  • 10
  • 22
0

You do not have permission so install it locally using:

pip install django --user

This will install it in .local you have to append the variable PYTHONPATH with this.

aristotll
  • 8,694
  • 6
  • 33
  • 53
tupui
  • 5,738
  • 3
  • 31
  • 52
0

You might forgot to activate/install python virtual env. Same issue addressed here

Ravi
  • 216
  • 3
  • 11
0

Activate virtualenv(source env/bin/activate) and try installing again.

rajkris
  • 1,775
  • 1
  • 9
  • 16