2015-12-13 43 views
0

我想安装Django并遇到错误。这对我来说一直是一个错误,我一直无法解决如何解决。我在Mac上。下载django时出错

Installing collected packages: Django 
Exception: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main 
    status = self.run(options, args) 
     File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/commands/install.py", line 311, in run 
     root=options.root_path, 
     File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 646, in install 
     **kwargs 
     File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 803, in install 
     self.move_wheel_files(self.source_dir, root=root) 
     File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 998, in move_wheel_files 
     isolated=self.isolated, 
     File "/Library/Python/2.7/site-packages/pip-7.1.2-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.2-py2.7.egg/pip/wheel.py", line 310, in clobber 
     ensure_dir(destdir) 
     File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/utils/__init__.py", line 71, 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' 
+0

的错误是,你没有足够的权限在默认位置安装Django。它更好地安装在virtualenv里面的django。这样,你不会遇到权限问题。另外,软件包等是特定项目的本地特性。 http://stackoverflow.com/questions/10066681/django-installation-first-time – karthikr

+0

也看看pyenv https://github.com/yyuu/pyenv https://github.com/yyuu/pyenv-virtualenv这可以让您轻松安装和管理python版本和虚拟环境。你不应该建立在你的本地mac python上。 – seeN

回答

1

为karthikr说,你需要

virtualenv project_env 
cd project_env 
. bin/activate 
sudo pip install Django