Python method of recording install third-party packages "tesserocr" and encountered pit

1. Environment:

System Environment: Win7 32-bit system

Python Version: 3.6.5 virtual environment: Miniconda3

2. Total need to install the module:

a. tesserocr 

b. tesseract

c. PILL

3. INSTALLATION:

My installation order: b -> a -> c

In fact, the most troublesome installation, the module is being given up to tesserocr, I tried the following command:

pip install tesserocr

pip3 install tesserocr

conda install tesserocr

conda install - c simonflueckiger tesserocr

The first three simply does not work

The last is indeed able to find the resources tesserocr, but did not move down, I guess if the hang proxy to download, then maybe do it, conditions can try.

Finally, I resolved to do is reference to this blog : Win7 system installation and tesserocr tesseract  in talking about ways the Internet to download the tesserocr-2.4.0-cp36-cp36m- win32.whl this .whl file to install, very good , installation is very smooth. Which should be noted is that , when you execute : PIP install tesserocr-2.4.0-CP36-cp36m-win32.whl this command when, if you did not put your downloaded files on .whl words in the correct file directory this statement will complain, prompting you: tesserocr-2.4.0-cp36-cp36m -win32.whl seems to be a file name, but not the files in the directory barabara (of course, people are being given in English, I'll give you the translation) , it is easy to handle, it is based on its tips to the .whl it prompts file in the file directory just fine.

And then tell you about tesserocr and issues tesseract versions match , at first I did not know how to install these things, so when downloading the tesseract (Download also refer to my previously mentioned blog) I downloaded the latest version of the tesseract (tesseract-ocr-w32-setup -v5.0.0-alpha.20191030), thinking that certainly is the latest version of the most powerful thing, and then found a lot of people say online version tesserocr to match the version and the tesseract, as shown below:

 

But I installed tesseract-ocr-w32-setup-v5.0.0-alpha.20191030 time is really spent a long time, this installation method also refer to my previously mentioned blog. I really do not want to go to uninstall and then download a version tesserocr v2.4.0 to waste several hours to install it again, so I try to hold mentality, tried it, I found

Test code:

1 import tesserocr
2 from PIL import Image
3 
4 image = Image.open('image.png')
5 print(tesserocr.image_to_text(image))

operation result:

 

I did not expect it even to run successfully! ! !

Both versions are even said to the guy does not match to match I together? ? ?

 

That was okay, anyway, is not being given the best friends ~

最后再说一下关于 安装 pillow 遇到的报错

就是在Anaconda Promote中执行这条语句时:pip install pillow 报错了:Could not find a version that satisfies the requirement PIL (from versions: ) No matching distribution found for PIL。

这个的解决方案参考这篇博客:【Python】Could not find a version that satisfies the requirement PIL (from versions: ) No matching distribution found for PIL 按照他的解决方案解决即可。

 

最后的最后,出了文中提到的几篇博客之外,我觉得还有几篇讲得不错的博客推荐给大家,安装方法就不用过多关注了,按照我的方法来你们肯定能把环境搭起来了,这几篇博客就供大家取材用吧。

1. Python tesserocr模块使用示例

2. tesserocr最新版本2.4.0安装(windows)

3. 爬虫如何解决图片验证码问题

 

Guess you like

Origin www.cnblogs.com/maitre-zhao/p/12124494.html