解决 pip install -r requirements.txt 报错 | ERROR: Command errored out with exit status 1:

以下为安装依赖时遇到的报错

ERROR: Command errored out with exit status 1:
     command: 'c:\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Range\\AppData\\Local\\Temp\\pip-install-bnwdqkxb\\gevent\\setup.py'"'"'; __file__='"'"'C:\\Users\\Range\\AppData\\Local\\Temp\\pip-install-bnwdqkxb\\gevent\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:\Users\Range\AppData\Local\Temp\pip-install-bnwdqkxb\gevent\
    Complete output (45 lines):
    Traceback (most recent call last):
      File "", line 1, in 
      File "C:\Users\Range\AppData\Local\Temp\pip-install-bnwdqkxb\gevent\setup.py", line 427, in 
        run_setup(EXT_MODULES, run_make=_BUILDING)
      File "C:\Users\Range\AppData\Local\Temp\pip-install-bnwdqkxb\gevent\setup.py", line 328, in run_setup
        setup(
      File "c:\python38\lib\site-packages\setuptools\__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "c:\python38\lib\site-packages\setuptools\__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "c:\python38\lib\site-packages\setuptools\dist.py", line 716, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "c:\python38\lib\site-packages\pkg_resources\__init__.py", line 780, in resolve
        dist = best[req.key] = env.best_match(
      File "c:\python38\lib\site-packages\pkg_resources\__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "c:\python38\lib\site-packages\pkg_resources\__init__.py", line 1077, in obtain
        return installer(requirement)
      File "c:\python38\lib\site-packages\setuptools\dist.py", line 786, in fetch_build_egg
        return cmd.easy_install(req)
      File "c:\python38\lib\site-packages\setuptools\command\easy_install.py", line 665, in easy_install
        dist = self.package_index.fetch_distribution(
      File "c:\python38\lib\site-packages\setuptools\package_index.py", line 655, in fetch_distribution
        dist = find(requirement)
      File "c:\python38\lib\site-packages\setuptools\package_index.py", line 635, in find
        loc = self.download(dist.location, tmpdir)
      File "c:\python38\lib\site-packages\setuptools\package_index.py", line 579, in download
        found = self._download_url(scheme.group(1), spec, tmpdir)
      File "c:\python38\lib\site-packages\setuptools\package_index.py", line 824, in _download_url
        return self._attempt_download(url, filename)
      File "c:\python38\lib\site-packages\setuptools\package_index.py", line 830, in _attempt_download
        headers = self._download_to(url, filename)
      File "c:\python38\lib\site-packages\setuptools\package_index.py", line 745, in _download_to
        block = fp.read(bs)
      File "c:\python38\lib\http\client.py", line 454, in read
        n = self.readinto(b)
      File "c:\python38\lib\http\client.py", line 498, in readinto
        n = self.fp.readinto(b)
      File "c:\python38\lib\socket.py", line 669, in readinto
        return self._sock.recv_into(b)
      File "c:\python38\lib\ssl.py", line 1241, in recv_into
        return self.read(nbytes, buffer)
      File "c:\python38\lib\ssl.py", line 1099, in read
        return self._sslobj.read(len, buffer)
    socket.timeout: The read operation timed out
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

解决方法:

1.更新包管理器pip

python -m pip install --upgrade pip

2.更新setuptools

pip install --upgrade setuptools

References

[1]AllarZhao, 安装tldr出错ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for f

你可能感兴趣的:(python)