代码改变世界

Mac使用pip命令时BeautifulSoup4和jupyer套件安装失败

2018-03-04 11:18  Summer_chen  阅读(374)  评论(0)    收藏  举报

mac下更新pip时提示OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-8.0.2-py2.

     使用pip安装一个python库时提示pip版本过低,需要升级,执行 pip install --upgrade pip 后提示:

 

Collecting pip

  Using cached pip-8.1.0-py2.py3-none-any.whl

Installing collected packages: pip

  Found existing installation: pip 8.0.2

    Uninstalling pip-8.0.2:

Exception:

Traceback (most recent call last):

  File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/basecommand.py", line 209, in main

    status = self.run(options, args)

  File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/commands/install.py", line 317, in run

    prefix=options.prefix_path,

  File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_set.py", line 725, in install

    requirement.uninstall(auto_confirm=True)

  File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_install.py", line 752, in uninstall

    paths_to_remove.remove(auto_confirm)

  File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove

    renames(path, new_path)

  File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/utils/__init__.py", line 266, in renames

    shutil.move(old, new)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 300, in move

    rmtree(src)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 247, in rmtree

    rmtree(fullname, ignore_errors, onerror)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 252, in rmtree

    onerror(os.remove, fullname, sys.exc_info())

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 250, in rmtree

    os.remove(fullname)

OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/EGG-INFO/dependency_links.txt'

好像是权限问题,网上一顿搜索,各种英文答案看不太明白,突然在一个页面看到:sudo 这个词 ,试了一下:sudo  pip install --upgrade pip ok了!!!!!

 

特此纪念。