brew postinstall python(2.7.13):[Errno 13]权限被拒绝

哈维尔:

我在OS X 10.11.6上。我今天更新并升级了brew。在那之后,pip没有工作。看起来好像在升级期间未安装。完成升级后,我看到了警告:

Warning: The post-install step did not complete successfully You can try again using brew postinstall python

所以我跑了brew postinstall python,然后遇到了错误:

error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py'

他们这篇文章中说:

由于error: could not delete '/usr/local/lib/python2.7/site-packages/pip/__init__.py': Permission denied.手动删除该文件,然后运行brew postinstall python再次修复了该问题,因此安装后步骤未成功完成

所以我认为解决方法是相同的,/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py'因此我手动删除

$ ls /usr/local/lib/python2.7/site-packages/pkg_resources/
_vendor extern

我又跑了brew postinstall python一次,但现在我得到了:

...
copying build/lib/easy_install.py -> /usr/local/lib/python2.7/site-packages
copying build/lib/pkg_resources/__init__.py -> /usr/local/lib/python2.7/site-packages/pkg_resources
error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py'` 

我通过使用安装pip找到了“解决办法” easy_install

sudo easy_install pip

现在一切似乎都正常了。但是,我有两个问题:

  1. 我是否因手动删除而搞砸了'/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py'

  2. 什么[Errno 13] Permission denied时候解决brew postinstall python


如果有什么用,这里是我brew configbrew doctor今天发生的一切之后的输出:

$ brew config
HOMEBREW_VERSION: 1.1.6
ORIGIN: https://github.com/Homebrew/brew
HEAD: 619791e83d2781dca1b675e20249a8aebe085c7c
Last commit: 6 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 5ce01ec9c8b9958e2d9a7791e4d4e2aa0bf4fd8f
Core tap last commit: 89 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.10.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 1.8.0_91
macOS: 10.11.6-x86_64
Xcode: 8.2.1
CLT: 8.2.0.0.1.1480973914
X11: 2.7.11 => /opt/X11

$ brew doctor
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libtcl8.6.dylib
  /usr/local/lib/libtk8.6.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/fakemysql.h
  /usr/local/include/fakepq.h
  /usr/local/include/fakesql.h
  /usr/local/include/itcl.h
  /usr/local/include/itcl2TclOO.h
  /usr/local/include/itclDecls.h
  /usr/local/include/itclInt.h
  /usr/local/include/itclIntDecls.h
  /usr/local/include/itclMigrate2TclCore.h
  /usr/local/include/itclTclIntStubsFcn.h
  /usr/local/include/mysqlStubs.h
  /usr/local/include/odbcStubs.h
  /usr/local/include/pqStubs.h
  /usr/local/include/tcl.h
  /usr/local/include/tclDecls.h
  /usr/local/include/tclOO.h
  /usr/local/include/tclOODecls.h
  /usr/local/include/tclPlatDecls.h
  /usr/local/include/tclThread.h
  /usr/local/include/tclTomMath.h
  /usr/local/include/tclTomMathDecls.h
  /usr/local/include/tdbc.h
  /usr/local/include/tdbcDecls.h
  /usr/local/include/tdbcInt.h
  /usr/local/include/tk.h
  /usr/local/include/tkDecls.h
  /usr/local/include/tkPlatDecls.h

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
  /usr/local/lib/pkgconfig/tcl.pc
  /usr/local/lib/pkgconfig/tk.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
  /usr/local/lib/libtclstub8.6.a
  /usr/local/lib/libtkstub8.6.a
布莱恩·布鲁格曼:

我发现解决此问题的最简单方法是简单地将文件夹的所有权设置为您的用户名:

chown -R `whoami` /usr/local/lib/python2.7/site-packages/

编辑:有时,我也运行此命令:

sudo -H python3 -m pip install ... 

要么

sudo -H pip install

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

安装Django的“ PermissionError:[Errno 13]权限被拒绝:'/ usr / lib / python3.5 / site-packages'”

IOError:[Errno 13]权限被拒绝:运行Python / Selenium时'geckodriver.log

Python CGIHTTPServer崩溃,并显示“ OSError:[Errno 13]权限被拒绝”

Python socket.error:[Errno 13]权限被拒绝

Python-IOError:[Errno 13]权限被拒绝:

OSError:[Errno 13]权限被拒绝:'/ dev / ttyACM0'-使用从Python到Arduino的pyserial

IOError:[Errno 13]权限被拒绝

Python-Errno 13尝试复制文件时权限被拒绝

Python [Errno 13]权限被拒绝:

Errno 13权限被拒绝Python

USBError:[Errno 13]访问被拒绝(权限不足)

PermissionError Errno 13权限被拒绝

具有GNU / Linux和os.makedirs()的Python3.7-PermissionError:[Errno 13]权限被拒绝

PermissionError:[Errno 13]运行以Python编码的服务器端CGI脚本时,权限被拒绝

eb创建:错误:PermissionError-[Errno 13]权限被拒绝:'./catroot2\\edb.log'

Python pytesseract问题在Mac中打开“ [Errno 13]权限被拒绝:”

OSError:[Errno 13]权限被拒绝Python subprocess.call()

python paramiko在使用sftp的Windows服务器上给出错误“权限被拒绝[Errno 13]”

Python Errno13权限被拒绝

无法在 docker 中使用解释器运行 python 脚本 [Errno 13] 权限被拒绝

Python [Errno 13] 打开某些图像时权限被拒绝

无法在 Mac 上安装 psycopg2,OSError: Errno13 权限被拒绝

Python Heroku 允许推送 .exe 运行 - OSError: [Errno 13] 权限被拒绝

BlueData MLOPS - PermissionError: [Errno 13] 权限被拒绝

权限问题 - PermissionError [Errno 13] 权限被拒绝

PermissionError: [errno 13] 在 Windows 10 中运行 python 脚本时权限被拒绝

Errno 13 下载文件的权限被拒绝

PermissionError: [Errno 13] 权限被拒绝:Python

PermissionError: [Errno 13] 权限被 Binance API (python) 拒绝