在64位Ubuntu 14.04 python 3.5.1(或3.4)上找不到libtiff模块

我的问题与此几乎完全相同,但没有一个解决方案适合我。 我假设有python 2.7的问题,因为我的问题是特定于python 3.5.1

TL; DR:以下命令均不起作用,详情如下

  • sudo apt-get install libtiff5
  • sudo dpkg -i libtiff5_4.0.3-7ubuntu0.3_amd64.deb
  • python setup.py install( pylibtiff ,一个libtiff包装器)
  • conda安装libtiff
  • pip安装libtiff

我尝试过的:

卡雷尔的方法

cornelis@Bob:~$ sudo apt-get install libtiff5 Reading package lists... Done Building dependency tree Reading state information... Done libtiff5 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 342 not upgraded. cornelis@Bob:~$ python Python 3.5.1 |Anaconda 2.4.1 (64-bit)| (default, Dec 7 2015, 11:16:01) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from libtiff import TIFF Traceback (most recent call last): File "", line 1, in  ImportError: No module named 'libtiff' 

ShubhamGG的方法 (修改为libtiff5 )

 cornelis@Bob:~/Downloads$ sudo dpkg -i libtiff5_4.0.3-7ubuntu0.3_amd64.deb (Reading database ... 228352 files and directories currently installed.) Preparing to unpack libtiff5_4.0.3-7ubuntu0.3_amd64.deb ... Unpacking libtiff5:amd64 (4.0.3-7ubuntu0.3) over (4.0.3-7ubuntu0.3) ... Setting up libtiff5:amd64 (4.0.3-7ubuntu0.3) ... Processing triggers for libc-bin (2.19-0ubuntu6.6) ... cornelis@Bob:~/Downloads$ python Python 3.5.1 |Anaconda 2.4.1 (64-bit)| (default, Dec 7 2015, 11:16:01) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from libtiff import TIFF Traceback (most recent call last): File "", line 1, in  File "/home/cornelis/Downloads/libtiff/__init__.py", line 20, in  from .libtiff_ctypes import libtiff, TIFF, TIFF3D File "/home/cornelis/Downloads/libtiff/libtiff_ctypes.py", line 31 print 'You should add %r to PATH environment variable and reboot.' % (os.path.dirname (lib)) ^ SyntaxError: invalid syntax >>> 

我不确定%r to PATH environment variable%r to PATH environment variable什么意思。 但是,我确实重启了。 没有效果。

接下来我尝试了pylibtiff

 cornelis@Bob:~/Downloads/pylibtiff-svn$ python setup.py install 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') Warning: Assuming default configuration (libtiff/bitarray-0.3.5-numpy/bitarray/{setup_bitarray,setup}.py was not found)Traceback (most recent call last): File "setup.py", line 96, in  configuration = configuration, File "/home/cornelis/anaconda3/lib/python3.5/site-packages/numpy/distutils/core.py", line 135, in setup config = configuration() File "setup.py", line 67, in configuration config.get_version('libtiff/version.py') File "/home/cornelis/anaconda3/lib/python3.5/site-packages/numpy/distutils/misc_util.py", line 1918, in get_version version_module = imp.load_module('_'.join(n.split('.')),*info) File "/home/cornelis/anaconda3/lib/python3.5/imp.py", line 234, in load_module return load_source(name, filename, file) File "/home/cornelis/anaconda3/lib/python3.5/imp.py", line 172, in load_source module = _load(spec) File "", line 693, in _load File "", line 673, in _load_unlocked File "", line 658, in exec_module File "", line 764, in get_code File "", line 724, in source_to_code File "", line 222, in _call_with_frames_removed File "libtiff/version.py", line 30 print version ^ SyntaxError: Missing parentheses in call to 'print' 

康达尝试

 cornelis@Bob:~/Downloads$ conda install libtiff Fetching package metadata: .... Solving package specifications: .................... # All requested packages already installed. # packages in environment at /home/cornelis/anaconda3: # libtiff 4.0.6 1 cornelis@Bob:~/Downloads$ python Python 3.5.1 |Anaconda 2.4.1 (64-bit)| (default, Dec 7 2015, 11:16:01) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from libtiff import TIFF Traceback (most recent call last): File "", line 1, in  File "/home/cornelis/Downloads/libtiff/__init__.py", line 20, in  from .libtiff_ctypes import libtiff, TIFF, TIFF3D File "/home/cornelis/Downloads/libtiff/libtiff_ctypes.py", line 31 print 'You should add %r to PATH environment variable and reboot.' % (os.path.dirname (lib)) ^ SyntaxError: invalid syntax >>> 

点子尝试

 cornelis@Bob:~/Downloads$ pip install libtiff Collecting libtiff Using cached libtiff-0.4.0.tar.gz Complete output from command python setup.py egg_info: Warning: Assuming default configuration (libtiff/bitarray-0.3.5-numpy/bitarray/{setup_bitarray,setup}.py was not found)Traceback (most recent call last): File "", line 1, in  File "/tmp/pip-build-90idcgcx/libtiff/setup.py", line 96, in  configuration = configuration, File "/home/cornelis/anaconda3/lib/python3.5/site-packages/numpy/distutils/core.py", line 135, in setup config = configuration() File "/tmp/pip-build-90idcgcx/libtiff/setup.py", line 67, in configuration config.get_version('libtiff/version.py') File "/home/cornelis/anaconda3/lib/python3.5/site-packages/numpy/distutils/misc_util.py", line 1918, in get_version version_module = imp.load_module('_'.join(n.split('.')),*info) File "/home/cornelis/anaconda3/lib/python3.5/imp.py", line 234, in load_module return load_source(name, filename, file) File "/home/cornelis/anaconda3/lib/python3.5/imp.py", line 172, in load_source module = _load(spec) File "", line 693, in _load File "", line 673, in _load_unlocked File "", line 658, in exec_module File "", line 764, in get_code File "", line 724, in source_to_code File "", line 222, in _call_with_frames_removed File "libtiff/version.py", line 30 print version ^ SyntaxError: Missing parentheses in call to 'print' 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') ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-90idcgcx/libtiff