简体   繁体   English

修复mac预安装的python

[英]fixing mac preinstalled python

Recently I try to install some package or update the pip, similar error message pops out. 最近我尝试安装一些软件包或更新pip,弹出类似的错误信息。

Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 311, in run
    root=options.root_path,
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 640, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_install.py", line 716, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 125, in remove
    renames(path, new_path)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/utils/__init__.py", line 315, in renames
    shutil.move(old, new)
  File `enter code here`"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/2.7/bin/pip'

I think that might due to an improper uninstallation of python on macport cause it, as when I try to change different python with the use of 我认为可能是因为在macport上不正确地卸载了python导致它,就像当我尝试使用的更改不同的python时

port select --list python

and

sudo port select --set "python name"

and when I type 当我打字的时候

which python

all of them leads to 所有这些都导致了

/opt/local/bin/python

none of them connected to the Frameworks. 它们都没有连接到框架。 I wanna ask is there anyway to restore the mac preinstalled python? 我想问是否还有恢复mac预安装的python?

这个问题只是通过运行解决了

sudo pip install --upgrade pip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM