简体   繁体   English

在Mac上使用pip安装Django时出错

[英]Error from installing Django using pip on mac

Hello I'm getting this error on my mac when i tried installing Django using pip. 您好,当我尝试使用pip安装Django时,我的Mac上出现此错误。 I created a directory and virtual environment. 我创建了目录和虚拟环境。 But ran into this error when attempting to install django. 但是在尝试安装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'

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. 似乎您正在运行默认的pip,并且您没有安装到目录中的权限。 If you run sudo pip install django it should work. 如果您运行sudo pip install django它应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM