-1

Obtained the following code through pip install django==1.7.1

Downloading/unpacking django==1.7.1­­
Downloading Django-1.7.1-py2.py3-none-any.whl (7.4MB): 7.4MB downloaded
Installing collected packages: django
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 279, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Python/2.7/site-packages/pip/req.py", line 1380, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pip/req.py", line 664, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/Library/Python/2.7/site-packages/pip/req.py", line 894, in move_wheel_files
    pycompile=self.pycompile,
  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 202, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 189, in clobber
    os.makedirs(destsubdir)
  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'

Storing debug log for failure in /Users/hansonzihanzeng/Library/Logs/pip.log
Leistungsabfall
  • 6,368
  • 7
  • 33
  • 41
Hanson
  • 5
  • 4

2 Answers2

0

You should write

sudo pip install django==1.7.1

You got a Permission Denied error, that means the process can't write to the directory because it doesn't have enough privileges.

ForceBru
  • 43,482
  • 10
  • 63
  • 98
0

You have to use sudo to allow permissions to write it.

sudo pip install django==1.7.1

If however you want to install it on Python3 (3.x), you'll have to use pip3

sudo pip3 install django==1.7.1

However if you give yourself root priviledges in the terminal you don't have to use sudo. You get root by using the sudo su command and entering your password. Once that is done, any actions taken in that window are considered to have root permission. However this is generally not good practice.

Meghdeep Ray
  • 5,262
  • 4
  • 34
  • 58