【问题标题】:Unable to install pytesseract for the python 3.8.10 in Alibaba EC Instance (Ubuntu 20.04.2)无法在阿里巴巴 EC 实例 (Ubuntu 20.04.2) 中为 python 3.8.10 安装 pytesseract
【发布时间】:2021-10-03 14:49:20
【问题描述】:

环境:

阿里巴巴弹性计算实例 操作系统 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('"'"'\r\n'"'"', '"'"'\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.

有人知道我做错了什么吗?

【问题讨论】:

  • 错误显示PIL 有问题,这意味着模块Pillow

标签: python ubuntu python-tesseract


【解决方案1】:

尝试先安装 Pillow:

python3 -m pip install --upgrade Pillow

如果您想了解有关如何安装的更多信息,请点击此处:link

【讨论】:

    猜你喜欢
    • 2019-07-04
    • 1970-01-01
    • 2019-12-25
    • 2021-12-18
    • 2020-09-22
    • 2021-03-01
    • 2019-01-11
    • 1970-01-01
    • 2020-06-28
    相关资源
    最近更新 更多