pip安裝html5lib包的時候報一下錯誤:html
➜ /test sudo pip install html5libhtml5
The directory '/Users/lele/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.python
The directory '/Users/lele/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.web
Collecting html5libapi
Downloading html5lib-1.0.1-py2.py3-none-any.whl (117kB)app
100% |████████████████████████████████| 122kB 61kB/spython2.7
Requirement already satisfied: webencodings in /Library/Python/2.7/site-packages (from html5lib)ide
Collecting six>=1.9 (from html5lib)網站
Downloading six-1.11.0-py2.py3-none-any.whlui
Installing collected packages: six, html5lib
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-L0B9DH-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
這是由於OS X El Capitan發行時已經安裝了六個1.4.1,當它試圖卸載它時(由於awscli依賴於botocore,botocore依賴於python-dateutil,python-dateutil依賴於六> = 1.5)由於系統完整性保護甚至不容許root修改這些目錄。
理想狀況下,點應該跳過卸載這些項目,由於他們沒有安裝到他們安裝到一個特殊的蘋果目錄的網站包。可是,即便點擊跳過卸載這些項目,並安裝六個站點包,咱們會遇到另外一個錯誤,蘋果把他們預先安裝的東西早於sys.path
站點包。
解決辦法:
➜ /test sudo pip install --ignore-installed six
The directory '/Users/lele/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/lele/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting six
Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.11.0
➜ /test sudo pip install html5lib
The directory '/Users/lele/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/lele/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting html5lib
Downloading html5lib-1.0.1-py2.py3-none-any.whl (117kB)
100% |████████████████████████████████| 122kB 137kB/s
Requirement already satisfied: webencodings in /Library/Python/2.7/site-packages (from html5lib)
Requirement already satisfied: six>=1.9 in /Library/Python/2.7/site-packages (from html5lib)
Installing collected packages: html5lib
Successfully installed html5lib-1.0.1