安装 libtiff 的时候出现了报错,无论是用 pip
或者 conda
或者去github下载源代码 python setup.py install
都会出现报错:
解决办法试了很多中,包括曾经以为是 setuptools
的问题,也试过很多其他channels , 后来用命令 conda list libtiff
看看安装成功的同事他们的版本,都是有两个版本:
第一个4.0.9我是已经安装,那就是0.4.2没有的原因了。结合报错,原因应该是microsoft visual c++ 14.0 缺失导致 wheel 没有 build 成功。
解决办法就是俩:
- 下载安装 microsoft visual c++ 14.0
- 就是直接下载 wheel 文件
下载网址:
libtiff-install-success.png
https://www.lfd.uci.edu/~gohlke/pythonlibs/
安装命令:
pip install c:\Users\username\...\....whl
这篇博客作者遇到的问题一样:
附上所有的报错:
(base) C:\Users\hellome>pip install libtiff
Collecting libtiff
Using cached https://files.pythonhosted.org/packages/18/8f/b844284d43d385c0896
7b25eb76f625a5f06490cc4680e17644587053756/libtiff-0.4.2.tar.gz
Building wheels for collected packages: libtiff
Running setup.py bdist_wheel for libtiff ... error
Complete output from command d:\programdata\anaconda3\python.exe -u -c "import
setuptools, tokenize;__file__='C:\\Users\\hellome\\AppData\\Local\\Temp\\pip-inst
all-nb7glkzr\\libtiff\\setup.py';f=getattr(tokenize, 'open', open)(__file__);cod
e=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))
" bdist_wheel -d C:\Users\hellome\AppData\Local\Temp\pip-wheel-qxyu0g44 --python-t
ag cp36:
Appending libtiff.bitarray configuration to libtiff
Ignoring attempt to set 'name' (from 'libtiff' to 'libtiff.bitarray')
Appending libtiff configuration to
Ignoring attempt to set 'name' (from '' to 'libtiff')
0.4.2
running bdist_wheel
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler op
tions
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler o
ptions
running build_src
build_src
building extension "bittools" sources
building extension "tif_lzw" sources
building extension "libtiff.bitarray._bitarray" sources
building extension "libtiff.bittools" sources
building extension "libtiff.tif_lzw" sources
building data_files sources
build_src: building npy-pkg config files
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\libtiff
copying libtiff\libtiff_ctypes.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\lsm.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\lzw.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\optparse_gui.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\script_options.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\setup.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\test_bittools.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_array.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_base.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_channels_and_files.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_data.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_file.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_files.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_3_8_2.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_3_9_2.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_3_9_4.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_3_9_5.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_1.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_2.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_3.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_6.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_7.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_8.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_9.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_image.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_sample_plane.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\utils.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\version.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\__init__.py -> build\lib.win-amd64-3.6\libtiff
creating build\lib.win-amd64-3.6\libtiff\bitarray
copying libtiff\bitarray-a1646c0\bitarray\test_bitarray.py -> build\lib.win-am
d64-3.6\libtiff\bitarray
copying libtiff\bitarray-a1646c0\bitarray\__init__.py -> build\lib.win-amd64-3
.6\libtiff\bitarray
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying fro
m distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
building 'bittools' extension
compiling C sources
Warning: Assuming default configuration (libtiff\bitarray-a1646c0\bitarray/{se
tup_bitarray,setup}.py was not found)error: Microsoft Visual C++ 14.0 is require
d. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudi
o.com/visual-cpp-build-tools
----------------------------------------
Failed building wheel for libtiff
Running setup.py clean for libtiff
Failed to build libtiff
Installing collected packages: libtiff
Running setup.py install for libtiff ... error
Complete output from command d:\programdata\anaconda3\python.exe -u -c "impo
rt setuptools, tokenize;__file__='C:\\Users\\hellome\\AppData\\Local\\Temp\\pip-in
stall-nb7glkzr\\libtiff\\setup.py';f=getattr(tokenize, 'open', open)(__file__);c
ode=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'
))" install --record C:\Users\hellome\AppData\Local\Temp\pip-record-466na39l\insta
ll-record.txt --single-version-externally-managed --compile:
Appending libtiff.bitarray configuration to libtiff
Ignoring attempt to set 'name' (from 'libtiff' to 'libtiff.bitarray')
Appending libtiff configuration to
Ignoring attempt to set 'name' (from '' to 'libtiff')
0.4.2
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler
options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler
options
running build_src
build_src
building extension "bittools" sources
building extension "tif_lzw" sources
building extension "libtiff.bitarray._bitarray" sources
building extension "libtiff.bittools" sources
building extension "libtiff.tif_lzw" sources
building data_files sources
build_src: building npy-pkg config files
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\libtiff
copying libtiff\libtiff_ctypes.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\lsm.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\lzw.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\optparse_gui.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\script_options.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\setup.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\test_bittools.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_array.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_base.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_channels_and_files.py -> build\lib.win-amd64-3.6\libtif
f
copying libtiff\tiff_data.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_file.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_files.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_3_8_2.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_3_9_2.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_3_9_4.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_3_9_5.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_1.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_2.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_3.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_6.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_7.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_8.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_h_4_0_9.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_image.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\tiff_sample_plane.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\utils.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\version.py -> build\lib.win-amd64-3.6\libtiff
copying libtiff\__init__.py -> build\lib.win-amd64-3.6\libtiff
creating build\lib.win-amd64-3.6\libtiff\bitarray
copying libtiff\bitarray-a1646c0\bitarray\test_bitarray.py -> build\lib.win-
amd64-3.6\libtiff\bitarray
copying libtiff\bitarray-a1646c0\bitarray\__init__.py -> build\lib.win-amd64
-3.6\libtiff\bitarray
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying f
rom distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
building 'bittools' extension
compiling C sources
Warning: Assuming default configuration (libtiff\bitarray-a1646c0\bitarray/{
setup_bitarray,setup}.py was not found)error: Microsoft Visual C++ 14.0 is requi
red. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstu
dio.com/visual-cpp-build-tools
----------------------------------------
Command "d:\programdata\anaconda3\python.exe -u -c "import setuptools, tokenize;
__file__='C:\\Users\\hellome\\AppData\\Local\\Temp\\pip-install-nb7glkzr\\libtiff\
\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\hellome\AppData\Local\Temp\pip-record-466na39l\install-record.txt --single-v
ersion-externally-managed --compile" failed with error code 1 in C:\Users\hellome\
AppData\Local\Temp\pip-install-nb7glkzr\libtiff\
网友评论