我正嘗試安裝django使用pip在終端中。pip安裝django錯誤
但是,我總是得到一個異常。最後一個錯誤總是「權限被拒絕」,我不明白爲什麼。任何幫助表示讚賞。
登錄:
pip install django
You are using pip version 7.1.0, however version 8.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting django
Using cached Django-1.9.4-py2.py3-none-any.whl
Installing collected packages: django
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py", line 299, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 646, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py", line 813, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py", line 1008, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/wheel.py", line 339, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/wheel.py", line 310, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/__init__.py", line 70, 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'
你是如何安裝pip的?你通常需要用'sudo'運行這個嗎? – agconti
使用virtualenv:[http://jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-right-way/](http://jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-right-way /)和[http://docs.python-guide。組織/ EN /最新的/ dev/virtualenvs /(http://docs.python-guide.org/en/latest/dev/virtualenvs/)。因爲人們在回答,所以除非你使用sudo,否則你沒有權限。 –
可能重複的[PIP安裝錯誤django](https://stackoverflow.com/questions/27539816/pip-install-error-django) – erip