Windows安裝pycocotools的問題報錯解決
pycocotools庫的簡介
pycocotools即python api tools of COCO。COCO是一個大型的圖像數(shù)據(jù)集,用于目標檢測、分割、人的關(guān)鍵點檢測、素材分割和標題生成。這個包提供了Matlab、Python和luaapi,這些api有助于在COCO中加載、解析和可視化注釋。請訪問COCO - Common Objects in Context,可以了解關(guān)于COCO的更多信息,包括數(shù)據(jù)、論文和教程。COCO網(wǎng)站上也描述了注釋的確切格式。Matlab和PythonAPI是完整的,LuaAPI只提供基本功能。
直接用下面的代碼pip install 會報錯
pip install pycocotools-win
報錯信息:
ERROR: Command errored out with exit status 1: command: 'D:\Anaconda\anaconda\envs\pytorch1.10.1\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'D:\\temp\\pip-install-48raidr9\\pycocotools-win_9d4ff4791ad241a99d6dd3ac703b0b51\\setup.py'"'"'; __file__='"'"'D:\\temp\\pip-install -48raidr9\\pycocotools-win_9d4ff4791ad241a99d6dd3ac703b0b51\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '" '"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'D:\temp\pip-wheel-e6slyu_q' cwd: D:\temp\pip-install-48raidr9\pycocotools-win_9d4ff4791ad241a99d6dd3ac703b0b51\ Complete output (23 lines): running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-3.9 creating build\lib.win-amd64-3.9\pycocotools copying pycocotools\coco.py -> build\lib.win-amd64-3.9\pycocotools copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.9\pycocotools copying pycocotools\mask.py -> build\lib.win-amd64-3.9\pycocotools copying pycocotools\__init__.py -> build\lib.win-amd64-3.9\pycocotools running build_ext cythoning pycocotools/_mask.pyx to pycocotools\_mask.c D:\Anaconda\anaconda\envs\pytorch1.10.1\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: D:\temp\pip-install-48raidr9\pycocotools-win_9d4ff47 91ad241a99d6dd3ac703b0b51\pycocotools\_mask.pyx tree = Parsing.p_module(s, pxd, full_module_name) building 'pycocotools._mask' extension creating build\temp.win-amd64-3.9 creating build\temp.win-amd64-3.9\common creating build\temp.win-amd64-3.9\Release creating build\temp.win-amd64-3.9\Release\pycocotools "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -ID:\Anaconda\anaconda\envs\pytorch1.10.1\lib\site-packages\numpy\core\include -I../common -ID:\Anaconda\anaconda \envs\pytorch1.10.1\include -ID:\Anaconda\anaconda\envs\pytorch1.10.1\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.20.27508\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC \14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Ki ts\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj maskApi.c c1: fatal error C1083: 無法打開源文件: “../common/maskApi.c”: No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.20.27508\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 ---------------------------------------- ERROR: Failed building wheel for pycocotools-win Running setup.py clean for pycocotools-win Failed to build pycocotools-win Installing collected packages: pycocotools-win Running setup.py install for pycocotools-win ... error ERROR: Command errored out with exit status 1: command: 'D:\Anaconda\anaconda\envs\pytorch1.10.1\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'D:\\temp\\pip-install-48raidr9\\pycocotools-win_9d4ff4791ad241a99d6dd3ac703b0b51\\setup.py'"'"'; __file__='"'"'D:\\temp\\pip-insta ll-48raidr9\\pycocotools-win_9d4ff4791ad241a99d6dd3ac703b0b51\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'D:\temp\pip-record-v9coqsh6\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Anaconda\anaconda\envs\pytorch1.10.1\Include\pycocotools-win ' cwd: D:\temp\pip-install-48raidr9\pycocotools-win_9d4ff4791ad241a99d6dd3ac703b0b51\ Complete output (23 lines): running install D:\Anaconda\anaconda\envs\pytorch1.10.1\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py creating build creating build\lib.win-amd64-3.9 creating build\lib.win-amd64-3.9\pycocotools copying pycocotools\coco.py -> build\lib.win-amd64-3.9\pycocotools copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.9\pycocotools copying pycocotools\mask.py -> build\lib.win-amd64-3.9\pycocotools copying pycocotools\__init__.py -> build\lib.win-amd64-3.9\pycocotools running build_ext skipping 'pycocotools\_mask.c' Cython extension (up-to-date) building 'pycocotools._mask' extension creating build\temp.win-amd64-3.9 creating build\temp.win-amd64-3.9\common creating build\temp.win-amd64-3.9\Release creating build\temp.win-amd64-3.9\Release\pycocotools "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -ID:\Anaconda\anaconda\envs\pytorch1.10.1\lib\site-packages\numpy\core\include -I../common -ID:\Anaconda\anacon da\envs\pytorch1.10.1\include -ID:\Anaconda\anaconda\envs\pytorch1.10.1\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.20.27508\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MS VC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj maskApi.c c1: fatal error C1083: 無法打開源文件: “../common/maskApi.c”: No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.20.27508\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 ---------------------------------------- ERROR: Command errored out with exit status 1: 'D:\Anaconda\anaconda\envs\pytorch1.10.1\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'D:\\temp\\pip-install-48raidr9\\pycocotools-win_9d4ff4791ad241a99d6dd3ac703b0b51\\setup.py'"'"'; __file__='"'"'D:\\temp\\pip-install-48raidr9\\pycocotools-win_9d4ff4791ad241a99d6dd3ac703b0b51\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'D:\temp\pip-record-v9coqsh6\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Anaconda\anaconda\envs\pyto rch1.10.1\Include\pycocotools-win' Check the logs for full command output.
解決方法1(親測有效):
conda install -c conda-forge pycocotools
用conda裝一下就好了,并且速度也快!
解決方法2(未親測):
conda install pycocotools -c Esri
解決方案三:
直接把這個包下載下來放到你anaconda虛擬環(huán)境所在的目錄下中的site-packages文件夾內(nèi)
pycococtools的安裝包 pycocotools 提取碼: p691
下載解壓后得到兩個文件,將以上兩個文件夾復制至你anaconda虛擬環(huán)境所在的目錄下中的site-packages文件夾內(nèi) [1]
如博主的目錄為:
D:\Anaconda\ana\Lib\site-packages
參考資料:
Windows10安裝pycocotools報錯的一些解決方法
到此這篇關(guān)于Windows安裝pycocotools的實現(xiàn)示例的文章就介紹到這了,更多相關(guān)Windows安裝pycocotools內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
python基礎(chǔ)教程之基本內(nèi)置數(shù)據(jù)類型介紹
在Python程序中,每個數(shù)據(jù)都是對像,每個對像都有自己的一個類型。不同類型有不同的操作方法,使用內(nèi)置數(shù)據(jù)類型獨有的操作方法,可以更快的完成很多工作2014-02-02python 尋找list中最大元素對應(yīng)的索引方法
今天小編就為大家分享一篇python 尋找list中最大元素對應(yīng)的索引方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-06-06解決jupyter notebook打不開無反應(yīng) 瀏覽器未啟動的問題
這篇文章主要介紹了解決jupyter notebook打不開無反應(yīng) 瀏覽器未啟動的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-04-04python+openCV利用攝像頭實現(xiàn)人員活動檢測
這篇文章主要為大家詳細介紹了python+openCV利用攝像頭實現(xiàn)人員活動檢測,具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-06-06pandas數(shù)據(jù)清洗實現(xiàn)刪除的項目實踐
本文主要介紹了pandas數(shù)據(jù)清洗實現(xiàn)刪除的項目實踐,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2022-06-06python使用Pygal創(chuàng)建交互式圖表的示例代碼
Pygal 是一個用于生成高質(zhì)量、可縮放(SVG 格式)、可交互圖表的 Python 圖表庫,與傳統(tǒng)的圖表庫不同,Pygal 的輸出是基于矢量圖形的,本文給大家介紹了python使用Pygal創(chuàng)建交互式圖表的方法示例,需要的朋友可以參考下2024-12-12