window下pip安装模块报错(‘utf-8‘ codec can‘t decode byte 0xd5 in position 18: invalid continuation byte)


文章目录

    • 问题:
    • 解决步骤:
      • 从最后一个往上查找错误的代码:

问题: 这个时由于我按照一个模块,导致出现这样的错误。
错误代码:
Collecting pdoc Using cached pdoc-0.3.2.tar.gz (76 kB) ERROR: Exception: Traceback (most recent call last): File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in _main status = self.run(options, args) File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\cli\req_command.py", line 185, in wrapper return func(self, options, args) File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\commands\install.py", line 333, in run reqs, check_supported_wheels=not options.target_dir File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 179, in resolve discovered_reqs.extend(self._resolve_one(requirement_set, req)) File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 362, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 314, in _get_abstract_dist_for abstract_dist = self.preparer.prepare_linked_requirement(req) File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\operations\prepare.py", line 488, in prepare_linked_requirement req, self.req_tracker, self.finder, self.build_isolation, File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\operations\prepare.py", line 91, in _get_prepared_distribution abstract_dist.prepare_distribution_metadata(finder, build_isolation) File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\distributions\sdist.py", line 40, in prepare_distribution_metadata self.req.prepare_metadata() File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\req\req_install.py", line 550, in prepare_metadata self.metadata_directory = self._generate_metadata() File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\req\req_install.py", line 530, in _generate_metadata details=self.name or "from {}".format(self.link) File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\operations\build\metadata_legacy.py", line 73, in generate_metadata command_desc='python setup.py egg_info', File "d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\utils\subprocess.py", line 201, in call_subprocess line = console_to_str(proc.stdout.readline()) File "d:\python_work_tools\python3.6.8\lib\codecs.py", line 321, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 18: invalid continuation byte

解决步骤: 从最后一个往上查找错误的代码:
找到第二个时候,搜索encoding时候,发现了 我之前改的一个代码。我记得之前安装
d:\python_work_tools\python3.6.8\lib\site-packages\pip\_internal\utils\subprocess.py

之前安装模块,时定位到这个地方,修改encoding为utf-8时,问题解决,现在定位到这里,发现utf-8不能解决,所以把下面的一行,注释,使用原来的代码,结果就解决问题了。
window下pip安装模块报错(‘utf-8‘ codec can‘t decode byte 0xd5 in position 18: invalid continuation byte)
文章图片

【window下pip安装模块报错(‘utf-8‘ codec can‘t decode byte 0xd5 in position 18: invalid continuation byte)】成功安装:
window下pip安装模块报错(‘utf-8‘ codec can‘t decode byte 0xd5 in position 18: invalid continuation byte)
文章图片

    推荐阅读