1

在 Windows 平台上安装 OpenEXR 时遇到问题。我用pip install OpenEXR

ERROR: Command errored out with exit status 1:
     command: 'd:\dl-3d\gridding_residual_network\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\anujp\\AppData\\Local\\Temp\\pip-install-5adtpb33\\openexr_a32133
8e34444c229fc2744bf45c44e2\\setup.py'"'"'; __file__='"'"'C:\\Users\\anujp\\AppData\\Local\\Temp\\pip-install-5adtpb33\\openexr_a321338e34444c229fc2744bf45c44e2\\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\anujp\AppData\Local\Temp\pip-record-rpd0410_\inst
all-record.txt' --single-version-externally-managed --compile --install-headers 'd:\dl-3d\gridding_residual_network\include\site\python3.7\OpenEXR'
         cwd: C:\Users\anujp\AppData\Local\Temp\pip-install-5adtpb33\openexr_a321338e34444c229fc2744bf45c44e2\
    Complete output (15 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    copying Imath.py -> build\lib.win-amd64-3.7
    running build_ext
    building 'OpenEXR' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR -I/
opt/local/include/OpenEXR -Id:\dl-3d\gridding_residual_network\include -IC:\Users\anujp\AppData\Local\Programs\Python\Python37\include -IC:\Users\anujp\AppData\Local\Programs\Python\Python37\include "-IC:\P
rogram Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\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" /EHsc /TpOpenEXR.cpp /Fobuild\temp.win-amd64-3.7\Release\OpenEXR.obj
 -g -DVERSION="1.3.2"
    cl : Command line warning D9002 : ignoring unknown option '-g'
    OpenEXR.cpp
    OpenEXR.cpp(36): fatal error C1083: Cannot open include file: 'ImathBox.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\dl-3d\gridding_residual_network\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\anujp\\AppData\\Local\\Temp\\pip
-install-5adtpb33\\openexr_a321338e34444c229fc2744bf45c44e2\\setup.py'"'"'; __file__='"'"'C:\\Users\\anujp\\AppData\\Local\\Temp\\pip-install-5adtpb33\\openexr_a321338e34444c229fc2744bf45c44e2\\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\anujp\AppData\Lo
cal\Temp\pip-record-rpd0410_\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\dl-3d\gridding_residual_network\include\site\python3.7\OpenEXR' Check the logs for full c
ommand output.

(gridding_residual_network) D:\Dl-3d\gridding_residual_network>pip install OpenEXR
Collecting OpenEXR
  Using cached OpenEXR-1.3.2.tar.gz (10 kB)
Using legacy 'setup.py install' for OpenEXR, since package 'wheel' is not installed.
Installing collected packages: OpenEXR
    Running setup.py install for OpenEXR ... error
    ERROR: Command errored out with exit status 1:
     command: 'd:\dl-3d\gridding_residual_network\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\anujp\\AppData\\Local\\Temp\\pip-install-okpybcu1\\openexr_a7958a
1d3c7a4b8bab4d443151977a78\\setup.py'"'"'; __file__='"'"'C:\\Users\\anujp\\AppData\\Local\\Temp\\pip-install-okpybcu1\\openexr_a7958a1d3c7a4b8bab4d443151977a78\\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\anujp\AppData\Local\Temp\pip-record-5ebwe65m\inst
all-record.txt' --single-version-externally-managed --compile --install-headers 'd:\dl-3d\gridding_residual_network\include\site\python3.7\OpenEXR'
         cwd: C:\Users\anujp\AppData\Local\Temp\pip-install-okpybcu1\openexr_a7958a1d3c7a4b8bab4d443151977a78\
    Complete output (15 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    copying Imath.py -> build\lib.win-amd64-3.7
    running build_ext
    building 'OpenEXR' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR -I/
opt/local/include/OpenEXR -Id:\dl-3d\gridding_residual_network\include -IC:\Users\anujp\AppData\Local\Programs\Python\Python37\include -IC:\Users\anujp\AppData\Local\Programs\Python\Python37\include "-IC:\P
rogram Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\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" /EHsc /TpOpenEXR.cpp /Fobuild\temp.win-amd64-3.7\Release\OpenEXR.obj
 -g -DVERSION="1.3.2"
    cl : Command line warning D9002 : ignoring unknown option '-g'
    OpenEXR.cpp
    OpenEXR.cpp(36): fatal error C1083: Cannot open include file: 'ImathBox.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\dl-3d\gridding_residual_network\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\anujp\\AppData\\Local\\Temp\\pip
-install-okpybcu1\\openexr_a7958a1d3c7a4b8bab4d443151977a78\\setup.py'"'"'; __file__='"'"'C:\\Users\\anujp\\AppData\\Local\\Temp\\pip-install-okpybcu1\\openexr_a7958a1d3c7a4b8bab4d443151977a78\\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\anujp\AppData\Lo
cal\Temp\pip-record-5ebwe65m\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\dl-3d\gridding_residual_network\include\site\python3.7\OpenEXR' Check the logs for full c
ommand output.

我无法解决问题。我使用的是 python 3.7。请提出一个可能的解决方案。

4

1 回答 1

0

我有同样的问题。经过一番研究,我在 GitHub 上发现了一些与此相关的问题,例如 [ 1 ]、[ 2 ]、[ 3 ]。显然,在安装 Python 包之前,需要在系统上安装 openexr C++ 库。

在 Ubuntu 上你可以简单地做sudo apt-get install libopenexr-dev,但对于 Windows,你似乎需要从这个 repo自己编译它。

但是,这里有一些 Python 包的非官方 Windows 二进制文件列表,其中包括OpenEXR并为我工作。我只是下载了相应的版本并安装了它,就我而言:

python -m pip install OpenEXR‑1.3.2‑cp36‑cp36m‑win_amd64.whl

于 2021-06-23T15:10:30.257 回答