【发布时间】:2015-06-30 16:58:04
【问题描述】:
我一直在尝试安装 NumPy,并且一直在使用它。无论我尝试什么,我都会不断收到异常错误。我用了命令
$pip install numpy
但它抛出了这个错误
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/basecommand.py", line 246, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/commands/install.py", line 352, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_set.py", line 693, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_install.py", line 817, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_install.py", line 1018, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/wheel.py", line 269, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/wheel.py", line 215, in clobber
shutil.copyfile(srcfile, destfile)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/local/man/man1/nosetests.1'
只是为了检查,我在 Python 中使用了 import 来查看它是否有任何东西,但它也抛出了一个错误。我不知道发生了什么。
$pip install scipy
没有给我带来任何问题。任何帮助表示赞赏!我似乎找不到任何有关如何解决此问题的信息。
谢谢!
【问题讨论】:
-
看起来它试图全局安装,所以你需要权限,或者使用 virtualenv 创建虚拟存储,在那里你可以毫无问题地安装 numpy。正是在您的情况下,它说它无法将文件复制到
/usr/local/man/man1/nosetests.1 -
好的。我将如何获得它的权限? sudo 会做正确的事吗?我还应该提到,当我再次尝试运行 pip 时,它告诉我 numpy 已经安装并且是最新的。
-
是的,
sudo可以帮助您。或者,如果您全局不需要它,请尝试创建一个virtualenv -
尝试用 sudo 运行它告诉我与第二次运行它时相同,它已经安装并且是最新的。我确实需要它。
-
在他们之后尝试
pip uninstall numpy和sudo install numpy。
标签: python numpy installation pip