直接pip install pyexr
报错如下:
Building wheels for collected packages: OpenEXR
Building wheel for OpenEXR (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/liutong/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-27w0cp27/openexr_ea45721825e34560ad3038b2307617b2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-27w0cp27/openexr_ea45721825e34560ad3038b2307617b2/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 /tmp/pip-wheel-8utnk5sl
cwd: /tmp/pip-install-27w0cp27/openexr_ea45721825e34560ad3038b2307617b2/
Complete output (14 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
copying Imath.py -> build/lib.linux-x86_64-3.8
running build_ext
building 'OpenEXR' extension
creating build/temp.linux-x86_64-3.8
gcc -pthread -B /home/liutong/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR -I/opt/local/include/OpenEXR -I/home/liutong/anaconda3/include/python3.8 -c OpenEXR.cpp -o build/temp.linux-x86_64-3.8/OpenEXR.o -g -DVERSION="1.3.2"
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
OpenEXR.cpp:36:22: fatal error: ImathBox.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for OpenEXR
Running setup.py clean for OpenEXR
Failed to build OpenEXR
然后去网上找了一下pyexr的安装方式,找到了这篇博客:linux环境下安装pyexr的历程
他的方法二是完全不可行的,因为那个链接里面的文件都是适合安装在Windows下的whl文件,但是我用他的方法四也是会失败。
后面我发现,直接follow pyexr的github就能成功:pyexr
sudo apt install libopenexr-dev # (ubuntu)
pip install git+https://github.com/jamesbowman/openexrpython.git (dependency) # or try `conda install -c conda-forge openexr-python`
pip install pyexr
在这里第二步我用的是conda install -c conda-forge openexr-python