Meu problema é praticamente idêntico ao aqui exceto que nenhuma das soluções está funcionando para mim. Eu estou assumindo o problema que havia para python 2.7 porque o meu problema é específico para python 3.5.1
TL; DR: Os seguintes comandos não funcionam, detalhes abaixo
O que eu tentei:
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'
método de ShubhamGG (modificado para 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
>>>
Não tenho certeza do que significa %r to PATH environment variable
. No entanto, eu reiniciei. Sem efeito.
Em seguida, tentei 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'
tentativa da 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
>>>
Tentativa de Pip
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