Не удалось установить pytesseract для python 3.8.10 в экземпляре Alibaba EC (Ubuntu 20.04.2)

#python #ubuntu #python-tesseract

Вопрос:

Окружающая среда:

Экземпляр эластичного вычислительного экземпляра Alibaba ОС Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-77-generic x86_64) python 3.8.10

Я не могу установить в соответствии с приведенной ниже командой.

pip install pytesseract

также используется

pip3 install pytesseract

и я получаю следующую ошибку.

 Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting pytesseract
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a3/c9/d6e8903482bd6fb994c32722831d15842dd8b614f94ad9ca735807252671/pytesseract-0.3.8.tar.gz (14 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9ia5l4ys/pytesseract/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9ia5l4ys/pytesseract/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-9ia5l4ys/pytesseract/pip-egg-info
         cwd: /tmp/pip-install-9ia5l4ys/pytesseract/
    Complete output (42 lines):
    Traceback (most recent call last):
      File "/tmp/pip-install-9ia5l4ys/pytesseract/pytesseract/pytesseract.py", line 26, in <module>
        from PIL import Image
    ModuleNotFoundError: No module named 'PIL'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-9ia5l4ys/pytesseract/setup.py", line 4, in <module>
        setup()
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.8/distutils/core.py", line 121, in setup
        dist.parse_config_files()
      File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 701, in parse_config_files
        parse_configuration(self, self.command_options,
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 121, in parse_configuration
        meta.parse()
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 426, in parse
        section_parser_method(section_options)
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 399, in parse_section
        self[name] = value
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 184, in __setitem__
        value = parser(value)
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 515, in _parse_version
        version = self._parse_attr(value, self.package_dir)
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 349, in _parse_attr
        module = import_module(module_name)
      File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 848, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/tmp/pip-install-9ia5l4ys/pytesseract/pytesseract/__init__.py", line 2, in <module>
        from .pytesseract import ALTONotSupported
      File "/tmp/pip-install-9ia5l4ys/pytesseract/pytesseract/pytesseract.py", line 28, in <module>
        import Image
    ModuleNotFoundError: No module named 'Image'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
 

Есть ли у кого-нибудь идея, что я делаю не так?

Комментарии:

1. ошибка показывает проблему, с PIL которой означает подушку модуля

Ответ №1:

Попробуйте сначала установить подушку:

 python3 -m pip install --upgrade Pillow
 

Здесь, если вы хотите получить дополнительную информацию о том, как установить: ссылка!