pytesser 调用了 tesseract,因此需要安装 tesseract,安装 tesseract 需要安装 leptonica
安装列表:
leptonica
tesseract 以及 tesseract 语言包
pytesser
错误:
IOError: decoder zip not available
方法一:有可能不成功
Then, on 32-bit Ubuntu, you should run:
sudo ln -s /usr/lib/i386-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/
Otherwise, on 64-bit Ubuntu, you should run:
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/
方法二:
修改 setup.py 搜索
/usr/lib/添加
/usr/lib/x86_64-linux-gnu/
参考:
# rm -rf /usr/local/lib/python2.7/site-packages/PIL*
# rm -rf /src/Imaging-1.1.7
# cd /src
# tar -xvzf Imaging-1.1.7.tar.gz
# cd Imaging-1.1.7
# python2.7 setup.py build_ext -i
# python2.7 selftest.py
# python2.7
>>> import _imaging
>>> [(k, v) for k, v in vars(_imaging).items() if k[0] == 'z']
#Confirmed that the zip decoder libs were there
# python2.7 setup.py install
In trying to retrace my steps to figure out where I went wrong, I think
I used the "simple" install method listed at the top of the README (0.
If you're in a hurry...) first. All the supporting libraries were in
place in their standard locations so I figured I was safe for the simple
install. Note to self...) ;)
Anyway, i remember that this failed to find 3/5 libraries. It appears
that the build process does not check /usr/lib64 by default (which is
one of the default locations for libraries on a Linux x64 system. So, I
updated setup.py with the necessary paths to the libs.
I believe I then tried a "setup.py clean" command to reset the build
directories... Something along those lines. In any case, it appears I
did not get the original failed install out of the system when I thought
I had and that is what was tripping me up all along.
# rm -rf /src/Imaging-1.1.7
# cd /src
# tar -xvzf Imaging-1.1.7.tar.gz
# cd Imaging-1.1.7
# python2.7 setup.py build_ext -i
# python2.7 selftest.py
# python2.7
>>> import _imaging
>>> [(k, v) for k, v in vars(_imaging).items() if k[0] == 'z']
#Confirmed that the zip decoder libs were there
# python2.7 setup.py install
In trying to retrace my steps to figure out where I went wrong, I think
I used the "simple" install method listed at the top of the README (0.
If you're in a hurry...) first. All the supporting libraries were in
place in their standard locations so I figured I was safe for the simple
install. Note to self...) ;)
Anyway, i remember that this failed to find 3/5 libraries. It appears
that the build process does not check /usr/lib64 by default (which is
one of the default locations for libraries on a Linux x64 system. So, I
updated setup.py with the necessary paths to the libs.
I believe I then tried a "setup.py clean" command to reset the build
directories... Something along those lines. In any case, it appears I
did not get the original failed install out of the system when I thought
I had and that is what was tripping me up all along.
IOError: [Errno 2] No such file or directory: 'tesseract.log'
安装 语言包 English language data for Tesseract (3.00 and up)
安装教程: