1

Recently I try to install some package or update the pip, similar error message pops out.

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

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?

Peter Pang
  • 145
  • 5
  • So what does `port select list python` show (update your question with the output)? Also the error shows you are attempting to update a system file in `/Library`, which is wrong. Have you seen [this](http://stackoverflow.com/questions/17271319/installing-pip-on-mac-os-x)? – Droppy Jun 29 '16 at 12:40
  • http://johnlaudun.org/20150512-installing-and-setting-pip-with-macports/ you can try – Destrif Jun 29 '16 at 12:42
  • @Droppy when I type port select --list python these shows up none python26-apple python27 (active) python27-apple but all of them just connected to /opt/local/bin/python . – Peter Pang Jun 29 '16 at 12:48
  • @Desrif, I have try the link previously but it just does not work. – Peter Pang Jun 29 '16 at 12:48
  • @Droppy I have tried the link and reinstalled pip as shown in the link. But the same error pops up when I try to update it. – Peter Pang Jun 30 '16 at 09:39

1 Answers1

0

The problem was solved simply by running

sudo pip install --upgrade pip
Peter Pang
  • 145
  • 5