2016-06-07 96 views
0

我想在我的macosx上安装pymongo。使用python -m pip install pymongo,我得到这个错误信息:在macosx上安装pymongo

Exception: 
Traceback (most recent call last): 
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/basecommand.py", line 209, in main 
status = self.run(options, args) 
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/commands/install.py", line 317, in run 
prefix=options.prefix_path, 
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_set.py", line 732, in install 
**kwargs 
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_install.py", line 835, in install 
self.move_wheel_files(self.source_dir, root=root, prefix=prefix) 
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_install.py", line 1030, in move_wheel_files 
isolated=self.isolated, 
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/wheel.py", line 344, in move_wheel_files 
clobber(source, lib_dir, True) 
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/wheel.py", line 315, in clobber 
ensure_dir(destdir) 
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/utils/__init__.py", line 83, 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/bson' 

我得到使用的easy_install

The following error occurred while trying to add or remove files in the installation directory: 

[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-526.pth' 

The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: 

/Library/Python/2.7/site-packages/ 

Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. 

回答

1

这是因为你没有运行它作为root其他错误消息。最安全的做法是使用“用户”模式将您的需求安装到您的主目录中。

例如为:

python -m pip install --user pymongo