【问题标题】:Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output - while installing auto-py-to-exe through pip命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出 - 通过 pip 安装 auto-py-to-exe 时
【发布时间】:2020-07-18 16:19:15
【问题描述】:

我正在尝试在不同于我通常通过 pip 使用的(Windows)设备上下载 auto-py-to-exe。然而,当我运行时,我得到了错误(对不起,它太长了):

ERROR: Command errored out with exit status 1:
     command: 'c:\users\tom\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-aplljhe0\\gevent\\setup.py'"'"'; __file__='"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-aplljhe0\\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 'C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\pip-egg-info'
         cwd: C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\
    Complete output (113 lines):
    Traceback (most recent call last):
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver
        return self.find_available_vc_vers()[-1]
    IndexError: list index out of range

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
        yield saved
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
        yield
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "C:\Users\tom\AppData\Local\Temp\easy_install-29et0so1\cffi-1.14.0\setup.py", line 127, in <module>
        HUB_PRIMITIVES = Extension(name="gevent.__hub_primitives",
      File "C:\Users\tom\AppData\Local\Temp\easy_install-29et0so1\cffi-1.14.0\setup.py", line 105, in uses_msvc
        include_dirs=include_dirs)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\command\config.py", line 225, in try_compile
        self._compile(body, headers, include_dirs, lang)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\command\config.py", line 132, in _compile
        self.compiler.compile([src], include_dirs=include_dirs)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 360, in compile
        self.initialize()
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 253, in initialize
        vc_env = _get_vc_env(plat_spec)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
        return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 843, in __init__
        self.si = SystemInfo(self.ri, vc_ver)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 485, in __init__
        self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
        raise distutils.errors.DistutilsPlatformError(err)
    distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\setup.py", line 427, in <module>
        run_setup(EXT_MODULES, run_make=_BUILDING)
      File "C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\setup.py", line 328, in run_setup
        setup(
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\dist.py", line 716, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py", line 780, in resolve
        dist = best[req.key] = env.best_match(
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py", line 1077, in obtain
        return installer(requirement)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\dist.py", line 786, in fetch_build_egg
        return cmd.easy_install(req)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\easy_install.py", line 679, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\easy_install.py", line 705, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\easy_install.py", line 890, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\easy_install.py", line 1158, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\easy_install.py", line 1144, in run_setup
        run_setup(setup_script, args)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 253, in run_setup
        raise
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\contextlib.py", line 131, in __exit__
        self.gen.throw(type, value, traceback)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
        yield
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\contextlib.py", line 131, in __exit__
        self.gen.throw(type, value, traceback)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 166, in save_modules
        saved_exc.resume()
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 141, in resume
        six.reraise(type, exc, self._tb)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\_vendor\six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
        yield saved
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
        yield
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "C:\Users\tom\AppData\Local\Temp\easy_install-29et0so1\cffi-1.14.0\setup.py", line 127, in <module>
        HUB_PRIMITIVES = Extension(name="gevent.__hub_primitives",
      File "C:\Users\tom\AppData\Local\Temp\easy_install-29et0so1\cffi-1.14.0\setup.py", line 105, in uses_msvc
        include_dirs=include_dirs)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\command\config.py", line 225, in try_compile
        self._compile(body, headers, include_dirs, lang)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\command\config.py", line 132, in _compile
        self.compiler.compile([src], include_dirs=include_dirs)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 360, in compile
        self.initialize()
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 253, in initialize
        vc_env = _get_vc_env(plat_spec)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
        return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 843, in __init__
        self.si = SystemInfo(self.ri, vc_ver)
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 485, in __init__
        self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
        raise distutils.errors.DistutilsPlatformError(err)
    distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

尽管它确实声明我需要 Visual Studio C++ 14.0,但我的计算机不会安装它,而且我以前不需要它。我检查了This Stack Overflow Question,但它与另一个 pip 安装有关并且没有答案。如果唯一的答案是安装 Visual Studio,那我就完蛋了。

【问题讨论】:

  • 你尝试了什么命令?
  • pip install auto-py-to-exe @Kalana
  • 你的python版本是什么
  • 我的 python 版本空闲 - 3.8 32bit @Kalana
  • 好吧,我在 9 个月后回头看这个问题,它有 18 个赞,浏览量约为 80k!这很大:)

标签: python cmd pip


【解决方案1】:

编辑

自从发布此答案以来,gevent 已经发布了几个新版本,包括 Windows 上 Python 3.8 的预构建轮子,因此不再需要 pip install gevent --pre - 只需像往常一样运行 pip install auto-py-to-exe 就可以了.

原答案

允许预发布 gevent 版本通过

$ pip install gevent --pre
$ pip install auto-py-to-exe

说明:auto-py-to-exe 可以安装在 Windows 上的 Python 3.8 上,没有任何问题(这可以通过运行 pip install auto-py-to-exe --no-deps 来验证)。但是,它需要安装bottle-websocket,而后者又具有gevent 依赖项。 gevent 尚未发布为 Python 3.8 提供预构建轮子的稳定版本(这将是 1.5),因此 pip 不会选择预构建轮子并尝试从源 dist 构建 gevent==1.4。安装 gevent 的预发布 1.5 版本可以避免这种情况。

【讨论】:

  • 哇,这很好用 - 谢谢。几乎让我想知道我是否需要悬赏它......
  • 很高兴我能帮上忙!我不知道你是否可以取消正在运行的赏金,但如果你这样做了,我不介意。
  • 第二个 pip install 对我返回了同样的错误(检查日志以获得完整的命令输出。)
  • @dekio 因为我已经写了我的答案,gevent 已经为 Python 3.8 发布了预构建的轮子,所以 pip install gevent --pre 命令应该不再是必要的了。如果您有另一个设置(例如 Python 3.9 而不是 3.8 等,或者安装了 32 位版本的 Python 而不是 64 位),请打开一个描述您的问题的新问题。
【解决方案2】:

在你的问题中,出现了两个问题

  1. IndexError: list index out of range
  2. distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required

对于第一个错误,你可以试试这段代码

pip install --no-use-wheel --upgrade distribute

如果--no-use-wheel 部分不起作用,请改用--no-binary :all:

Source


对于第二个错误,可以使用

pip install --upgrade setuptools

Source


如果以上方法都不起作用

  1. 如果您的构建工具进一步无法解决您的问题,请尝试通过此link 手动安装构建工具。

  2. 之后,您必须重新启动 PC 或笔记本电脑。

  3. 然后尝试再次运行您的代码

【讨论】:

  • 当我运行 pip install --no-use-wheel --upgrade Distribute 我没有得到这样的选项: --no-use-wheel C:\WINDOWS\system32>Source 'Source' is not识别为内部或外部命令、可运行程序或批处理文件。
  • 尝试使用pip3 而不是pip。并参考两个源链接。里面有很多建议
  • C:\WINDOWS\system32>pip3 install --no-use-wheel --upgrade 分发 用法:pip3 install [options] [package-index-options] ... pip3 install [options] -r [package-index-options] ... pip3 install [options] [-e] ... pip3 install [options] [-e] ... pip3 install [options] ...没有这样的选项:--no-use-wheel
  • 升级你的pip 然后使用 pip3
  • @alper 尝试使用--no-binary :all:Source.
【解决方案3】:

用于在 mac 上安装 GDAL:

brew install gdal 然后 pip install gdal 为我解决了这个问题

【讨论】:

  • 这个命令的真正作用是什么?我的已经运行了 30 分钟,下载了我不知道的文件……考虑到我不知道它实际上做了什么,这真的很烦人……倒这个然后再回到下载
猜你喜欢
  • 2021-01-04
  • 2020-03-03
  • 2021-09-03
  • 2020-04-07
  • 2020-04-12
  • 1970-01-01
  • 2021-04-15
  • 2020-02-17
  • 2020-11-30
相关资源
最近更新 更多