gpt4 book ai didi

python - 导入具有 Visual C++ 依赖项的包时出错 : invalid numeric argument '/Wno-cpp'

转载 作者:行者123 更新时间:2023-12-02 02:50:39 25 4
gpt4 key购买 nike

我正在尝试在 Window 10 上使用 PyCharm 加载 pycocotools ( from here ) 包。

一开始我遇到了以下错误:

Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": 

因此,我安装了 Visual Studio 2019 并启用了 C++ 包。看起来它解决了错误,但现在我有另一个错误,这对我来说很神秘:

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.21.27702\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

这是完整的堆栈跟踪:

Collecting pycocotools
Using cached https://files.pythonhosted.org/packages/96/84/9a07b1095fd8555ba3f3d519517c8743c2554a245f9476e5e39869f948d2/pycocotools-2.0.0.tar.gz
Building wheels for collected packages: pycocotools
Running setup.py bdist_wheel for pycocotools: started
Running setup.py bdist_wheel for pycocotools: finished with status 'error'
Complete output from command [PATH\TO\VENV\]\plugin\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\[USER]\\AppData\\Local\\Temp\\pycharm-packaging\\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:\Users\[USER]~1\AppData\Local\Temp\pip-wheel-u3vetp7m --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.6\pycocotools
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\pycocotools
creating build\temp.win-amd64-3.6\Release\common
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I[PATH\TO\VENV\]\plugin\lib\site-packages\numpy\core\include -Icommon -I[PATH\TO\VENV\]\plugin\include -IC:\Users\[USER]\AppData\Local\Programs\Python\Python36\include -IC:\Users\[USER]\AppData\Local\Programs\Python\Python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\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" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj -Wno-cpp -Wno-unused-function -std=c99
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.21.27702\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

----------------------------------------
Running setup.py clean for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
Running setup.py install for pycocotools: started
Running setup.py install for pycocotools: finished with status 'error'
Complete output from command [PATH\TO\VENV\]\plugin\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\[USER]\\AppData\\Local\\Temp\\pycharm-packaging\\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:\Users\[USER]~1\AppData\Local\Temp\pip-record-9ez7fllv\install-record.txt --single-version-externally-managed --compile --install-headers [PATH\TO\VENV\]\plugin\include\site\python3.6\pycocotools:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.6\pycocotools
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\pycocotools
creating build\temp.win-amd64-3.6\Release\common
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I[PATH\TO\VENV\]\plugin\lib\site-packages\numpy\core\include -Icommon -I[PATH\TO\VENV\]\plugin\include -IC:\Users\[USER]\AppData\Local\Programs\Python\Python36\include -IC:\Users\[USER]\AppData\Local\Programs\Python\Python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\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" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj -Wno-cpp -Wno-unused-function -std=c99
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.21.27702\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

----------------------------------------

Failed building wheel for pycocotools
Command "[PATH\TO\VENV\]\plugin\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\[USER]\\AppData\\Local\\Temp\\pycharm-packaging\\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:\Users\[USER]~1\AppData\Local\Temp\pip-record-9ez7fllv\install-record.txt --single-version-externally-managed --compile --install-headers [PATH\TO\VENV\]\plugin\include\site\python3.6\pycocotools" failed with error code 1 in C:\Users\[USER]\AppData\Local\Temp\pycharm-packaging\pycocotools\
You are using pip version 10.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

可能是什么问题以及如何解决?

最佳答案

Coco 维护者不提供 Windows 中的支持,请检查 issue #9 :

We will not be providing Windows support.

但幸运的是,有一个可以在 Windows 上编译的分支:https://github.com/philferriere/cocoapi

只需运行:pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

关于python - 导入具有 Visual C++ 依赖项的包时出错 : invalid numeric argument '/Wno-cpp' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56274918/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com