一、报错:module ‘brotli’ has no attribute ‘error’
(tensorflow) C:\Users\86180>pip install numpy
Traceback (most recent call last):
File "D:\anaconda\envs\tensorflow\Scripts\pip-script.py", line 6, in <module>
from pip._internal.cli.main import main
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_internal\configuration.py", line 21, in <module>
from pip._internal.exceptions import (
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_internal\exceptions.py", line 8, in <module>
from pip._vendor.requests.models import Request, Response
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_vendor\requests\__init__.py", line 43, in <module>
from pip._vendor import urllib3
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 13, in <module>
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 40, in <module>
from .response import HTTPResponse
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 157, in <module>
class HTTPResponse(io.IOBase):
File "D:\anaconda\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 390, in HTTPResponse
DECODER_ERROR_CLASSES += (brotli.error,)
AttributeError: module 'brotli' has no attribute 'error'
二、解决方案:
1.打开D:\anaconda\envs\tensorflow\Lib\site-packages\pip_vendor\urllib3\response.py
2.注释389-390行代码
if brotli is not None:
DECODER_ERROR_CLASSES += (brotli.error,)
三、运行成功: