简体   繁体   English

无法在Ubuntu 16.04上使用pip3安装'tesserocr'

[英]Unable to install 'tesserocr' using pip3 on Ubuntu 16.04

I am trying to install the 'tesserocr' module for python 3.5 on Ubuntu 16.04 using the command 我正在尝试使用以下命令在Ubuntu 16.04上为python 3.5安装'tesserocr'模块

pip3 install tesserocr --user

OR 要么

sudo pip3 install tesserocr

I have already installed Tesseract 3.04 and Leptonica 1.73 using: 我已经使用以下命令安装了Tesseract 3.04和Leptonica 1.73:

sudo apt-get install tesseract-ocr libtesseract-dev libleptonica-dev

For some reason Cython is generating a compiler error when I try to install 'tesserocr' 由于某些原因,当我尝试安装“ tesserocr”时,Cython正在生成编译器错误

daksh@daksh-linux:~/tesser/tesseract$ sudo pip3 install tesserocr
[sudo] password for daksh: 
The directory '/home/daksh/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/daksh/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting tesserocr
  Downloading tesserocr-2.1.2.tar.gz (47kB)
    100% |████████████████████████████████| 51kB 1.6MB/s 
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/tesserocr.egg-info
    writing dependency_links to pip-egg-info/tesserocr.egg-info/dependency_links.txt
    writing pip-egg-info/tesserocr.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/tesserocr.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/tesserocr.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    Supporting tesseract v3.04.01
    Configs from pkg-config: {'cython_compile_time_env': {'TESSERACT_VERSION': 197633}, 'libraries': ['tesseract', 'lept'], 'include_dirs': ['/usr/include']}

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                bool b
                bool font_info
                TessResultRenderer *temp
                TessResultRenderer *renderer = NULL

            IF TESSERACT_VERSION >= 0x030401:
                                ^
    ------------------------------------------------------------

    tesserocr.pyx:1862:29: Compile-time name 'TESSERACT_VERSION' not defined

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                bool b
                bool font_info
                TessResultRenderer *temp
                TessResultRenderer *renderer = NULL

            IF TESSERACT_VERSION >= 0x030401:
                                ^
    ------------------------------------------------------------

    tesserocr.pyx:1862:29: Error in compile-time expression: TypeError: unorderable types: NoneType() >= int()

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-jnh9jb37/tesserocr/setup.py", line 166, in <module>
        test_suite='tests'
      File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 186, in run
        self.find_sources()
      File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 209, in find_sources
        mm.run()
      File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 293, in run
        self.add_defaults()
      File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 322, in add_defaults
        sdist.add_defaults(self)
      File "/usr/lib/python3/dist-packages/setuptools/command/sdist.py", line 132, in add_defaults
        build_ext = self.get_finalized_command('build_ext')
      File "/usr/lib/python3.5/distutils/cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/usr/lib/python3.5/distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/usr/local/lib/python3.5/dist-packages/Cython/Distutils/build_ext.py", line 19, in finalize_options
        self.distribution.ext_modules)
      File "/usr/local/lib/python3.5/dist-packages/Cython/Build/Dependencies.py", line 925, in cythonize
        cythonize_one(*args)
      File "/usr/local/lib/python3.5/dist-packages/Cython/Build/Dependencies.py", line 1047, in cythonize_one
        raise CompileError(None, pyx_file)
    Cython.Compiler.Errors.CompileError: tesserocr.pyx
    Compiling tesserocr.pyx because it changed.
    [1/1] Cythonizing tesserocr.pyx

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-jnh9jb37/tesserocr/

I don't understand why this is happening! 我不明白为什么会这样! :/ :/

我有同样的问题,我通过升级点来解决了

pip install --upgrade pip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM