pip throws TypeError:parse()在尝试安装新包时得到了一个意外的关键字参数'transport_encoding'

the*_*yup 95 python pip python-3.x anaconda

我使用的是最新版本的Anaconda3.我刚安装它,我正在尝试下载一些软件包.我正在使用Anaconda Prompt.在尝试使用pip执行任何操作(包括升级现有包)时,我得到以下回溯.

    Exception:
Traceback (most recent call last):
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in run
    wb.build(autobuilding=True)
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\req\req_set.py", line 487, in _prepare_file
    req_to_install, finder)
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\req\req_set.py", line 428, in _check_skip_installed
    req_to_install, upgrade_allowed)
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 811, in get_page
    inst = cls(resp.content, resp.url, resp.headers)
  File "C:\Users\csprock\Anaconda3\lib\site-packages\pip\index.py", line 731, in __init__
    namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?(此问题仅在我安装tensorflow后才开始)谢谢.

Tho*_*mer 196

我有同样的问题,对我有用的是用conda更新pip:

conda install pip

它将我的点从9.0.1-py36hadba87b_3改为9.0.1-py36h226ae91_4并解决了问题.

  • 很好的答案.工作和帮助很多 (3认同)
  • 也为我工作过!谢谢 (3认同)

小智 29

下载https://github.com/html5lib/html5lib-python/tree/master/html5lib并覆盖tensorflow环境中的html5lib文件夹中的所有文件"envs\tensorflow\Lib\site-packages\html5lib"然后你应该能够之后运行任何"pip install"命令

  • 回顾罗密欧的回答,"conda install --force html5lib"为我解决了这个问题. (45认同)
  • @MikeLanzetta解决方案对我不起作用.`conda install -c anaconda html5lib`工作 (5认同)

小智 10

在最新版本的Anaconda 3上安装keras(在使用pip安装tensorflow 1.3之后)遇到了同样的问题.我能够通过使用conda安装keras来解决问题 conda install -c conda-forge keras


Zim*_*her 7

我在安装SerpentAI时遇到了这个确切的错误.我所做的一切都是activate serpent在conda提示符下运行然后再次运行命令.不确定它是否适用于您的情况,但它们似乎足够接近它可能.

编辑 - 如果以上不起作用,请注释掉这一行: 在此输入图像描述

这对我很有用.(这需要我们社区有用的成员8个小时来调试)