Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
pip安装pkg授予的权限被拒绝:/Library/Python/2.7/site-packages/pkg_Python_Macos_Python 2.7_Homebrew - Fatal编程技术网

pip安装pkg授予的权限被拒绝:/Library/Python/2.7/site-packages/pkg

pip安装pkg授予的权限被拒绝:/Library/Python/2.7/site-packages/pkg,python,macos,python-2.7,homebrew,Python,Macos,Python 2.7,Homebrew,在使用brew重新安装Python在自制软件上重新安装Python 2后,今天的情况很有趣 例外情况 Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/Library/Python/2.

在使用
brew重新安装Python
在自制软件上重新安装Python 2后,今天的情况很有趣

例外情况

Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/Library/Python/2.7/site-packages/pip-9.0.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/urllib3’
相关资料

$ which python
/usr/local/bin/python

$ echo $PYTHONPATH
$

非常确定这是在使用OS X系统Python,但无法确定如何使用。

好-homebrew希望我在重新安装后使用
pip2
而不是
pip

我可能应该读一下文件,但无论如何,这不是主要问题

文件
/usr/local/bin/pip
的顶行现在是
#/usr/local/opt/python/bin/python2.7

这就是问题所在。将此行更改为:

A.
#/usr/local/bin/python

B.
#`brew--前缀“/bin/python

解决了这个问题

注意:我不能100%地把这归咎于自制。请注意此处发生的情况,但问题已为我解决

我还可以运行
sudopip…
,但这会弄乱macOS系统
站点包
目录,这通常被认为不是一个好主意