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

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

我的问题几乎与这里但那里的所有解决方案都对我不起作用。我假设那里的问题出在 Python 2.7 上,因为我的问题只出现在 Python 3.5.1 上

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

  • sudo apt-get 安装 libtiff5
  • sudo dpkg -i libtiff5_4.0.3-7ubuntu0.3_amd64.deb
  • python setup.py 安装(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 "<stdin>", line 1, in <module>
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 "<stdin>", line 1, in <module>
  File "/home/cornelis/Downloads/libtiff/__init__.py", line 20, in <module>
    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意思。不过,我确实重启了。没有效果。

接下来我尝试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 <module>
    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 "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 658, in exec_module
  File "<frozen importlib._bootstrap_external>", line 764, in get_code
  File "<frozen importlib._bootstrap_external>", line 724, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "libtiff/version.py", line 30
    print version
                ^
SyntaxError: Missing parentheses in call to 'print'

Conda 尝试

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 "<stdin>", line 1, in <module>
  File "/home/cornelis/Downloads/libtiff/__init__.py", line 20, in <module>
    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 "<string>", line 1, in <module>
      File "/tmp/pip-build-90idcgcx/libtiff/setup.py", line 96, in <module>
        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 "<frozen importlib._bootstrap>", line 693, in _load
      File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 658, in exec_module
      File "<frozen importlib._bootstrap_external>", line 764, in get_code
      File "<frozen importlib._bootstrap_external>", line 724, in source_to_code
      File "<frozen importlib._bootstrap>", 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

相关内容