Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。

  • 安装pip install pyquery 过程中出现如下错误:
pip install pyquery

Collecting pyquery
  Using cached https://files.pythonhosted.org/packages/09/c7/ce8c9c37ab8ff8337faad3335c088d60bed4a35a4bed33a64f0e64fbcf29/pyquery-1.4.0-py2.py3-none-any.whl
Collecting lxml>=2.1 (from pyquery)
  Using cached https://files.pythonhosted.org/packages/b9/55/bcc78c70e8ba30f51b5495eb0e3e949aa06e4a2de55b3de53dc9fa9653fa/lxml-4.2.5-cp36-cp36m-win_amd64.whl
Collecting cssselect>0.7.9 (from pyquery)
  Using cached https://files.pythonhosted.org/packages/7b/44/25b7283e50585f0b4156960691d951b05d061abf4a714078393e51929b30/cssselect-1.0.3-py2.py3-none-any.whl
Installing collected packages: lxml, cssselect, pyquery
Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'd:\anaconda3\Lib\site-packages\lxml\etree.cp36-win_amd64.pyd'
Consider using the `--user` option or check the permissions.

上面代码中最重要的是这句(第10行)Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'd:\anaconda3\Lib\site-packages\lxml\etree.cp36-win_amd64.pyd',意思是在安装pyquery的过程中由于lxml 中的etree.cp36-win_amd64.pyd 拒绝访问,导致安装失败。

解决办法

最简单的办法是删除lxml 文件夹,然后重新运行pip install pyquerypyquery下载成功,而且lxml-4.2.5 也重新被下载。猜测原因可能是因为在下载pyquery的过程中,还需要下载cssselect-1.0.3 lxml-4.2.5 ,因为之前已经安装过lxml,两个文件有冲突,所以导致安装失败。

pip install pyquery

Collecting pyquery
  Using cached https://files.pythonhosted.org/packages/09/c7/ce8c9c37ab8ff8337faad3335c088d60bed4a35a4bed33a64f0e64fbcf29/pyquery-1.4.0-py2.py3-none-any.whl
Collecting lxml>=2.1 (from pyquery)
  Using cached https://files.pythonhosted.org/packages/b9/55/bcc78c70e8ba30f51b5495eb0e3e949aa06e4a2de55b3de53dc9fa9653fa/lxml-4.2.5-cp36-cp36m-win_amd64.whl
Collecting cssselect>0.7.9 (from pyquery)
  Using cached https://files.pythonhosted.org/packages/7b/44/25b7283e50585f0b4156960691d951b05d061abf4a714078393e51929b30/cssselect-1.0.3-py2.py3-none-any.whl
Installing collected packages: lxml, cssselect, pyquery
Successfully installed cssselect-1.0.3 lxml-4.2.5 pyquery-1.4.0
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值