从github仓库安装pip文件时出现错误pip(以下载pycocotools)

时间:2020-10-14 21:52:36

标签: tensorflow github pip pycocotools

我正在安装Tensorflow(1.15.0)以执行一些深度学习对象检测,但是在安装pycocotools时遇到了麻烦。我正在关注this教程,这是YouTube频道Sentdex最初提供的更新的教程。我也正在为此使用Anaconda Prompt。

创建并激活conda环境并安装所有必需的软件包(TensorFlow,lxml等)后,我试图运行命令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. 软件包,但出现以下错误:

pip install git+https://github.com/philferriere/cocoapi#egg=pycocotools^subdirectory==PythonAPI

很明显,需要从this github存储库的子目录PythonAPI下下载一个wheel文件。我运行此代码是为了这样做:

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.

产生以下错误:

pip

如何成功安装此存储库?我需要wheel文件,以便可以继续进行pycocotools安装。注意:我已经安装了import tkinter as tk Window4 = tk.Tk() Window4.title("Budget Program") Window4.geometry("700x400") windowWidth = Window4.winfo_reqwidth() windowHeight = Window4.winfo_reqheight() positionRight = int(Window4.winfo_screenwidth() / 2 - windowWidth / 2) positionDown = int(Window4.winfo_screenheight() / 2 - windowHeight / 2) Window4.geometry("+{}+{}".format(positionRight, positionDown)) class App(object): def new_row(self): v = tk.StringVar() entry_Box = tk.Entry(Window4, width=15, textvariable=v) name = entry_Box.insert(0, "Name of income") entry_Box2 = tk.Entry(Window4, width=8) amount = entry_Box2.insert(0, "Amount") rate = OptionList = [ "Hourly", "Daily", "Weekly", "Monthly" ] variable = tk.StringVar(Window4) variable.set(OptionList[0]) opt = tk.OptionMenu(Window4, variable, *OptionList) opt.config(width=5, font=('Helvetica', 6)) blank = tk.Label(Window4, text=" ") # Put widgets in grid self.num_rows += 1 self.num_rows2 += 1 self.num_rows3 += 1 self.num_rows4 += 1 opt.grid(column=3, row=self.num_rows3) opt.bind("<Button-1>") entry_Box.grid(column=0, row=self.num_rows) def some_callback(event): entry_Box.delete(0, "end") return None entry_Box.bind("<Button-1>", some_callback) entry_Box2.grid(column=1, row=self.num_rows2) def some_callback(event): entry_Box2.delete(0, "end") return None entry_Box2.bind("<Button-1>", some_callback) blank.grid(column=6, row=self.num_rows4, padx=160) def __init__(self): self.num_rows = 1 self.num_rows2 = 1 self.num_rows3 = 1 self.num_rows4 = 1 createRow_button = tk.Button( Window4, text='Add income row', command=self.new_row) createRow_button.place(x=240, y=0) app = App() Window4.mainloop() 的最新版本,所以这不是问题。

1 个答案:

答案 0 :(得分:1)

尝试按以下方式运行它:

pip install pycocotools-windows

如建议的here

相关问题