Python pip 抛出 TypeError: parse() 在尝试安装新软件包时遇到了意外的关键字参数“transport_encoding”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46499808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
pip throws TypeError: parse() got an unexpected keyword argument 'transport_encoding' when trying to install new packages
提问by thewayup
I am using the latest version of Anaconda3. I just installed it and I am trying to download some packages. I am using the Anaconda Prompt. While trying to use pip to do anything (including upgrading existing packages) I get the following traceback.
我正在使用最新版本的 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'
Any ideas? (this problem only started after I installed tensorflow) Thanks.
有任何想法吗?(这个问题只在我安装 tensorflow 后才开始)谢谢。
回答by Thormer
I had the same problem and what worked for me was updating pip with conda:
我遇到了同样的问题,对我有用的是用 conda 更新 pip:
conda install pip
conda install pip
It changed my pip from 9.0.1-py36hadba87b_3 to 9.0.1-py36h226ae91_4 and solved issue.
它将我的 pip 从 9.0.1-py36hadba87b_3 更改为 9.0.1-py36h226ae91_4 并解决了问题。
回答by Romeo
download https://github.com/html5lib/html5lib-python/tree/master/html5liband overwrite all the files within html5lib folder in your tensorflow environment "envs\tensorflow\Lib\site-packages\html5lib" Then you should be able to run any "pip install" commands after that
下载https://github.com/html5lib/html5lib-python/tree/master/html5lib并覆盖 tensorflow 环境中 html5lib 文件夹中的所有文件“envs\tensorflow\Lib\site-packages\html5lib”然后你应该能够之后运行任何“pip install”命令
回答by Peach
I ran into the same problem while installing keras (after I installed tensorflow 1.3 using pip) on the latest version of Anaconda 3. I was able to fix the problem by installing keras using conda conda install -c conda-forge keras
在最新版本的 Anaconda 3 上安装 keras(在我使用 pip 安装 tensorflow 1.3 之后)时遇到了同样的问题。我能够通过使用 conda 安装 keras 来解决这个问题 conda install -c conda-forge keras
回答by Zimri Leisher
I was getting this exact error installing SerpentAI. All I did to fix it was run activate serpent
in conda prompt and then I ran the command again. Not sure if it's applicable to your situation, but they seem close enough that it might.
我在安装 SerpentAI 时遇到了这个确切的错误。我为修复它所做的一切都是activate serpent
在 conda 提示符下运行的,然后我再次运行该命令。不确定它是否适用于您的情况,但它们似乎足够接近。
EDIT - if the above didn't work, comment out this line:
That worked perfectly for me. (this took a helpful member of our community 8 hours to debug)
这对我来说非常有效。(这花了我们社区的一位乐于助人的成员 8 小时来调试)
回答by user3477889
This worked for me:
这对我有用:
python -m pip install --upgrade tensorflow
python -m pip install --upgrade tensorflow
回答by tgrrr
pip3 install -U html5lib=="0.9999999"
worked for me
为我工作
here's the html5lib bug on github
回答by TLK3
Here was the fix for me:
这是对我的修复:
cd /usr/share/python-wheels/
Contents of dir:
目录内容:
-rwxrwxrwx 1 www-data www-data 493905 Jul 22 2015 html5lib-0.999-py2.py3-none-any.whl
-rw-r--r-- 1 root root 112620 Apr 3 2019 html5lib-0.999999999-py2.py3-none-any.whl
Run:
跑:
mv html5lib-0.999-py2.py3-none-any.whl html5lib-0.999-py2.py3-none-any.whl.bak
pip3 works fine after. Was loading the old 0.999 version.
pip3 之后工作正常。正在加载旧的 0.999 版本。