解决 typeerror parse() got an unexpected keyword argument transport_encoding 错误

文章目录

typeerror parse() got an unexpected keyword argument transport_encoding错误

问题描述

最近安装一个第三方库,产生了如下问题:

C:\Windows\system32>pip install watchdog
Collecting watchdog
Exception:
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in run
    wb.build(autobuilding=True)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file
    require_hashes
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "C:\ProgramData\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:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 811, in get_page
    inst = cls(resp.content, resp.url, resp.headers)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 731, in __init__
    namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'
You are using pip version 9.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

产生的原因

是在安装了TensorFlow后出现,导致pip命令报错

处理方法

执行命令:conda install -c anaconda html5lib

C:\Windows\system32>conda install -c anaconda html5lib
Fetching package metadata ...............
Solving package specifications: .

Package plan for installation in environment C:\ProgramData\Anaconda3:

The following packages will be UPDATED:

    conda:          4.3.30-py36h7e176b0_0      --> 4.6.14-py36_0         anaconda
    html5lib:       0.999999999-py36ha09b1f3_0 --> 1.0.1-py36_0          anaconda
    menuinst:       1.4.10-py36h42196fb_0      --> 1.4.16-py36he774522_0 anaconda
    pycosat:        0.6.2-py36hf17546d_1       --> 0.6.3-py36hfa6e2cd_0  anaconda
    vc:             14-h2379b0c_2              --> 14.1-h21ff451_3       anaconda
    vs2015_runtime: 14.0.25123-hd4c4e62_2      --> 15.5.2-3              anaconda

The following packages will be SUPERSEDED by a higher-priority channel:

    conda-env:      2.6.0-h36134e3_1           --> 2.6.0-1               anaconda

Proceed ([y]/n)? y

menuinst-1.4.1 100% |###############################| Time: 0:00:02  94.58 kB/s
conda-env-2.6. 100% |###############################| Time: 0:00:00   2.83 MB/s
vs2015_runtime 100% |###############################| Time: 0:00:32  72.99 kB/s
vc-14.1-h21ff4 100% |###############################| Time: 0:00:00   3.12 MB/s
pycosat-0.6.3- 100% |###############################| Time: 0:00:03  32.21 kB/s
html5lib-1.0.1 100% |###############################| Time: 0:00:01 121.99 kB/s
conda-4.6.14-p 100% |###############################| Time: 0:00:36  60.54 kB/s

测试成功

C:\Windows\system32>pip install watchdog
Collecting watchdog
  Downloading https://files.pythonhosted.org/packages/bb/e3/5a55d48a29300160779f0a0d2776d17c1b762a2039b36de528b093b87d5b/watchdog-0.9.0.tar.gz (85kB)
    100% |████████████████████████████████| 92kB 17kB/s
Requirement already satisfied: PyYAML>=3.10 in c:\programdata\anaconda3\lib\site-packages (from watchdog)
Collecting argh>=0.24.1 (from watchdog)
  Downloading https://files.pythonhosted.org/packages/06/1c/e667a7126f0b84aaa1c56844337bf0ac12445d1beb9c8a6199a7314944bf/argh-0.26.2-py2.py3-none-any.whl
Collecting pathtools>=0.1.1 (from watchdog)
  Downloading https://files.pythonhosted.org/packages/e7/7f/470d6fcdf23f9f3518f6b0b76be9df16dcc8630ad409947f8be2eb0ed13a/pathtools-0.1.2.tar.gz
Building wheels for collected packages: watchdog, pathtools
  Running setup.py bdist_wheel for watchdog ... done
  Stored in directory: C:\Users\chengzy\AppData\Local\pip\Cache\wheels\61\1d\d0\04cfe495619be2095eb8d89a31c42adb4e42b76495bc8f784c
  Running setup.py bdist_wheel for pathtools ... done
  Stored in directory: C:\Users\chengzy\AppData\Local\pip\Cache\wheels\0b\04\79\c3b0c3a0266a3cb4376da31e5bfe8bba0c489246968a68e843
Successfully built watchdog pathtools
Installing collected packages: argh, pathtools, watchdog
Successfully installed argh-0.26.2 pathtools-0.1.2 watchdog-0.9.0
You are using pip version 9.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
上一篇:mysql5.6修改完my.ini字符集失效问题


下一篇:我的邮箱客户端程序Popmail