怎么安装安装html5lib,mac安装html5lib报错

在OS X El Capitan系统中使用pip安装html5lib时遇到了权限错误,因为系统完整性保护阻止了对预装six库的卸载。通过添加--ignore-installed参数来跳过卸载过程,成功安装了最新版本的six和html5lib。
摘要由CSDN通过智能技术生成

pip安装html5lib包的时候报一下错误:

➜  /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 61kB/s

Requirement already satisfied: webencodings in /Library/Python/2.7/site-packages (from html5lib)

Collecting six>=1.9 (from html5lib)

Downloading six-1.11.0-py2.py3-none-any.whl

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值