python3 安装tesserocr:pip install tesserocr pillow报错

安装python环境tesserocr时,使用pip install tesserocr pillow命令行,

下面的报错原因,很多人并不是特别清楚,包括我在内:

E:\Python>pip install tesserocr pillow
Collecting tesserocr
  Using cached https://files.pythonhosted.org/packages/92/2d/05a7f8387e93c192919b508e4f4936f232bd3d2ca388b9130ae538a9f9ad/tesserocr-2.4.0.tar.gz

Collecting pillow
  Using cached https://files.pythonhosted.org/packages/19/05/e7869088bcd791fe63f6d671577d25c4e3d1fecdc21501254621c65cd74b/Pillow-5.4.1-cp36-cp36
m-win32.whl
Installing collected packages: tesserocr, pillow
  Running setup.py install for tesserocr ... error
    Complete output from command e:\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\admin\\AppData\\Local\\Temp\\pip-i
nstall-9vats9x_\\tesserocr\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(cod
e, __file__, 'exec'))" install --record C:\Users\admin\AppData\Local\Temp\pip-record-t_hk__pf\install-record.txt --single-version-externally-man
aged --compile:
    Failed to extract tesseract version from executable: [WinError 2] 系统找不到指定的文件。
    Supporting tesseract v3.04.00
    Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 50593792}}
    running install
    running build
    running build_ext
    building 'tesserocr' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

    ----------------------------------------
Command "e:\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-9vats9x_\\tessero
cr\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" i
nstall --record C:\Users\admin\AppData\Local\Temp\pip-record-t_hk__pf\install-record.txt --single-version-externally-managed --compile" failed w
ith error code 1 in C:\Users\admin\AppData\Local\Temp\pip-install-9vats9x_\tesserocr\

解决办法:

E:\Python>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>> import pip._internal
>>> print(pip._internal.pep425tags.get_supported())
[('cp36', 'cp36m', 'win32'), ('cp36', 'none', 'win32'), ('py3', 'none', 'win32'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('py36', 'non
e', 'any'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31',
 'none', 'any'), ('py30', 'none', 'any')]

查看到对应的版本为cp36,cp36m,win32,之前下载安装的版本为win_amd64,版本冲突。

下载地址:https://github.com/simonflueckiger/tesserocr-windows_build/releases

重新下载tesserocr-2.4.0-cp36-cp36m-win32.whl 进行安装,一定是36-36-32,其他的经我亲自试过;

再执行pip install tesserocr-2.4.0-cp36-cp36m-win32.whl 安装成功。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值