错误:命令出错,退出状态为1

2024-10-01 02:23:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我试过:

pip3 install -r requirements.txt

以下是我收到的错误:

 Command "python setup.py egg_info" failed with error code 1 in 
 C:\Users\Admin\AppData\Local\Temp\pip-install-6c3rea1s\pycocotools\
 You are using pip version 19.0.3, however version 20.0.2 is available.
 You should consider upgrading via the 'python -m pip install --upgrade pip'
 command.

所以,我试着:

pip install --upgrade pip

install pip3 install -r requirements.txt

这导致了更多的错误:

 ERROR: Command errored out with exit status 1:      command:
 'c:\users\admin\appdata\local\programs\python\python37-32\python.exe'
 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-epmkeh4g\\pycocotools\\setup.py'"'"';
 __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-epmkeh4g\\pycocotools\\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\Admin\AppData\Local\Temp\pip-install-epmkeh4g\pycocotools\pip-egg-info'
         cwd:
 C:\Users\Admin\AppData\Local\Temp\pip-install-epmkeh4g\pycocotools\
    Complete output (5 lines):  Traceback (most recent call last):   
 File "<string>", line 1, in <module>     File
 "C:\Users\Admin\AppData\Local\Temp\pip-install-epmkeh4g\pycocotools\setup.py",
 line 2, in <module>        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'
    ---------------------------------------- ERROR: Command errored out
 with exit status 1: python setup.py egg_info Check the logs for full
 command output.

我删除了文件夹并重新安装,但结果保持不变


Tags: installpippyinfoadminegglocalwith
1条回答
网友
1楼 · 发布于 2024-10-01 02:23:38

这是pycocotools中的一个bug。这个bug已经修复了in 2017,但似乎修复没有在2018年进入2.0版(我猜发布过程也有bug)

^{}中还有另一个类似的错误-它在安装前导入numpy

对于这些bug,使用requirements.txt没有简单的解决方法。在安装pycocotools之前,您需要安装所需的模块:

pip install Cython numpy
pip install -r requirements.txt

相关问题 更多 >