项目需要用到pyexr这个包,本来以为很简单的问题但一直报错,经过两天的折腾终于安装成功了!在这里记录一下过程。
尝试一:首先直接输入:
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/chensiyu/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/chensiyu/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/chensiyu/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
尝试二:下载库文件
先在https://www.lfd.uci.edu/~gohlke/pythonlibs/下载对应的OpenEXR库文件,
再pip install xxx.whl 安装OpenEXR。
依然报错。。。
尝试三:github 安装依赖库
详细过程见: https://github.com/tvogels/pyexr
依然安装失败
尝试四:
conda install openexr-python #先安装openexr
pip install pyexr
大功告成!yeah!