修复mac预装python

2024-04-26 09:46:54 发布

您现在位置:Python中文网/ 问答频道 /正文

最近我试图安装一些软件包或更新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'

我认为这可能是由于在macport上不正确地卸载python造成的,就像我尝试使用

port select --list python

以及

sudo port select --set "python name"

当我打字的时候

which python

所有这些都导致

/opt/local/bin/python

它们都没有与框架相联系。 我想问的是,有没有恢复mac预装的python?你知道吗


Tags: installpippathinpylibpackagesline