首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从github仓库安装轮子文件时出错(下载pycocotools)

从github仓库安装轮子文件时出错(下载pycocotools)
EN

Stack Overflow用户
提问于 2020-10-15 05:52:37
回答 1查看 581关注 0票数 0

我正在安装Tensorflow (1.15.0),以便执行一些深度学习对象检测,但在安装pycocotools时遇到问题。我正在关注this教程,这是一个来自YouTube频道Sentdex的更新教程。为此,我也使用了Anaconda提示符。

在创建并激活conda环境并安装所有需要的包(TensorFlow、lxml等)之后,我尝试运行命令pip install pycocotools包,但得到以下错误:

代码语言:javascript
复制
Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (setup.py) ... error

  ERROR: Command errored out with exit status 1:
   command: 'C:\anaconda3\envs\object\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\AppData\Local\Temp\pip-wheel-au01c73g'
       cwd: C:\AppData\Local\Temp\pip-install-f_16w712\pycocotools\
  Complete output (16 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\pycocotools
  copying pycocotools\coco.py -> build\lib.win-amd64-3.7\pycocotools
  copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.7\pycocotools
  copying pycocotools\mask.py -> build\lib.win-amd64-3.7\pycocotools
  copying pycocotools\__init__.py -> build\lib.win-amd64-3.7\pycocotools
  running build_ext
  cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
  C:\anaconda3\envs\object\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\AppData\Local\Temp\pip-install-f_16w712\pycocotools\pycocotools\_mask.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  building 'pycocotools._mask' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
  ----------------------------------------
  ERROR: Failed building wheel for pycocotools
  Running setup.py clean for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
    Running setup.py install for pycocotools ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\anaconda3\envs\object\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\AppData\Local\Temp\pip-record-bjfh6urg\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\anaconda3\envs\object\Include\pycocotools'
         cwd: C:\AppData\Local\Temp\pip-install-f_16w712\pycocotools\
    Complete output (14 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\pycocotools
    copying pycocotools\coco.py -> build\lib.win-amd64-3.7\pycocotools
    copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.7\pycocotools
    copying pycocotools\mask.py -> build\lib.win-amd64-3.7\pycocotools
    copying pycocotools\__init__.py -> build\lib.win-amd64-3.7\pycocotools
    running build_ext
    skipping 'pycocotools\_mask.c' Cython extension (up-to-date)
    building 'pycocotools._mask' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\anaconda3\envs\object\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\AppData\\Local\\Temp\\pip-install-f_16w712\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\AppData\Local\Temp\pip-record-bjfh6urg\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\anaconda3\envs\object\Include\pycocotools' Check the logs for full command output.

显然,需要从PythonAPI子目录下的this github存储库下载一个轮子文件。我运行这段代码来做到这一点:

代码语言:javascript
复制
pip install git+https://github.com/philferriere/cocoapi#egg=pycocotools^subdirectory==PythonAPI

会产生以下错误:

代码语言:javascript
复制
Collecting pycocotoolssubdirectory==PythonAPI
  Cloning https://github.com/philferriere/cocoapi to c:\appdata\local\temp\pip-install-c_lq0qhi\pycocotoolssubdirectory
    ERROR: Command errored out with exit status 1:
     command: 'C:\anaconda3\envs\object\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\AppData\\Local\\Temp\\pip-install-c_lq0qhi\\pycocotoolssubdirectory\\setup.py'"'"'; __file__='"'"'C:\\AppData\\Local\\Temp\\pip-install-c_lq0qhi\\pycocotoolssubdirectory\\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:\AppData\Local\Temp\pip-pip-egg-info-0mcbi3nr'
         cwd: C:\AppData\Local\Temp\pip-install-c_lq0qhi\pycocotoolssubdirectory\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\anaconda3\envs\object\lib\tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\AppData\\Local\\Temp\\pip-install-c_lq0qhi\\pycocotoolssubdirectory\\setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

如何成功安装此存储库?我需要这个轮子文件,这样我才能继续安装pycocotools。注意:我已经安装了最新版本的pip,所以这不是问题所在。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-10-15 06:23:05

尝试运行它,如下所示:

代码语言:javascript
复制
pip install pycocotools-windows

如建议的here

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64362016

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档