python---pytessercat图片验证码,kali linux,Pillow,pytessercat,tesserocr的安装
来源:互联网 发布:不知为不知的知的意思 编辑:程序博客网 时间:2024/06/05 19:23
python—pytessercat图片验证码,kali linux,Pillow,pytessercat,tesserocr的安装
在kali linux 上安装Pillow,pytessercat,tesserocr
参考:http://www.oschina.net/question/54100_59400
源码文件:https://github.com/python-pillow/Pillowhttps://github.com/madmaze/pytesseracthttps://github.com/sirfz/tesserocrroot@kali:~/python/laowangpy/function# sudo apt-get install tesseract*root@kali:~/python/laowangpy/function# sudo apt-get install pytess*root@kali:~/python/laowangpy/function# cd /usr/share/第一步:先安装Pillow的PILroot@kali:/usr/share# git clone https://github.com/python-pillow/Pillow.gitroot@kali:/usr/share# cd Pillow/root@kali:/usr/share/Pillow# lsappveyor.yml docs LICENSE Pillow.egg-info setup.pybuild encode.c Makefile profile-installed.py test-installed.pybuild_children.sh _imaging.c MANIFEST.in py3.h TestsCHANGES.rst _imagingcms.c map.c README.rst Tkcodecov.yml _imagingft.c mp_compile.py RELEASING.md tox.inidecode.c _imagingmath.c mp_compile.pyc requirements.txt _webp.cdepends _imagingmorph.c outline.c Scripts winbuilddisplay.c _imagingtk.c path.c selftest.pydist libImaging PIL setup.cfgroot@kali:/usr/share/Pillow#python setup.py install第二步:安装pytesseractroot@kali:/usr/share# git clone https://github.com/madmaze/pytesseract.git正克隆到 'pytesseract'...root@kali:/usr/share# cd pytesseract/root@kali:/usr/share/pytesseract# lsbuild dist LICENSE MANIFEST.in pytesseract.egg-info README.rst setup.cfg setup.py srcroot@kali:/usr/share/pytesseract# python setup.py installrunning installChecking .pth file support in /usr/local/lib/python2.7/dist-packages//usr/bin/python -E -c passTEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth filesrunning bdist_eggrunning egg_infowriting requirements to pytesseract.egg-info/requires.txtwriting pytesseract.egg-info/PKG-INFOwriting top-level names to pytesseract.egg-info/top_level.txtwriting dependency_links to pytesseract.egg-info/dependency_links.txtwriting entry points to pytesseract.egg-info/entry_points.txtreading manifest file 'pytesseract.egg-info/SOURCES.txt'reading manifest template 'MANIFEST.in'writing manifest file 'pytesseract.egg-info/SOURCES.txt'installing library code to build/bdist.linux-i686/eggrunning install_librunning build_pycreating build/bdist.linux-i686/eggcreating build/bdist.linux-i686/egg/pytesseractcopying build/lib.linux-i686-2.7/pytesseract/pytesseract.py -> build/bdist.linux-i686/egg/pytesseractcopying build/lib.linux-i686-2.7/pytesseract/test-european.jpg -> build/bdist.linux-i686/egg/pytesseractcopying build/lib.linux-i686-2.7/pytesseract/__init__.py -> build/bdist.linux-i686/egg/pytesseractcopying build/lib.linux-i686-2.7/pytesseract/test.png -> build/bdist.linux-i686/egg/pytesseractbyte-compiling build/bdist.linux-i686/egg/pytesseract/pytesseract.py to pytesseract.pycbyte-compiling build/bdist.linux-i686/egg/pytesseract/__init__.py to __init__.pyccreating build/bdist.linux-i686/egg/EGG-INFOcopying pytesseract.egg-info/PKG-INFO -> build/bdist.linux-i686/egg/EGG-INFOcopying pytesseract.egg-info/SOURCES.txt -> build/bdist.linux-i686/egg/EGG-INFOcopying pytesseract.egg-info/dependency_links.txt -> build/bdist.linux-i686/egg/EGG-INFOcopying pytesseract.egg-info/entry_points.txt -> build/bdist.linux-i686/egg/EGG-INFOcopying pytesseract.egg-info/requires.txt -> build/bdist.linux-i686/egg/EGG-INFOcopying pytesseract.egg-info/top_level.txt -> build/bdist.linux-i686/egg/EGG-INFOzip_safe flag not set; analyzing archive contents...creating 'dist/pytesseract-0.1.7-py2.7.egg' and adding 'build/bdist.linux-i686/egg' to itremoving 'build/bdist.linux-i686/egg' (and everything under it)Processing pytesseract-0.1.7-py2.7.eggremoving '/usr/local/lib/python2.7/dist-packages/pytesseract-0.1.7-py2.7.egg' (and everything under it)creating /usr/local/lib/python2.7/dist-packages/pytesseract-0.1.7-py2.7.eggExtracting pytesseract-0.1.7-py2.7.egg to /usr/local/lib/python2.7/dist-packagespytesseract 0.1.7 is already the active version in easy-install.pthInstalling pytesseract script to /usr/local/binInstalled /usr/local/lib/python2.7/dist-packages/pytesseract-0.1.7-py2.7.eggProcessing dependencies for pytesseract==0.1.7Searching for Pillow==4.4.0.dev0Best match: Pillow 4.4.0.dev0Processing Pillow-4.4.0.dev0-py2.7-linux-i686.eggPillow 4.4.0.dev0 is already the active version in easy-install.pthInstalling viewer.py script to /usr/local/binInstalling player.py script to /usr/local/binInstalling explode.py script to /usr/local/binInstalling painter.py script to /usr/local/binInstalling pildriver.py script to /usr/local/binInstalling pilfont.py script to /usr/local/binInstalling pilprint.py script to /usr/local/binInstalling gifmaker.py script to /usr/local/binInstalling pilfile.py script to /usr/local/binInstalling pilconvert.py script to /usr/local/binInstalling enhancer.py script to /usr/local/binInstalling thresholder.py script to /usr/local/binUsing /usr/local/lib/python2.7/dist-packages/Pillow-4.4.0.dev0-py2.7-linux-i686.eggFinished processing dependencies for pytesseract==0.1.7root@kali:/usr/share/pytesseract# cd ..第三步:安装tesserocrroot@kali:/usr/share# export GIT_SSL_NO_VERIFY=1root@kali:/usr/share# git clone https://github.com/sirfz/tesserocr.git正克隆到 'tesserocr'...remote: Counting objects: 332, done.remote: Total 332 (delta 0), reused 0 (delta 0), pack-reused 332Receiving objects: 100% (332/332), 381.39 KiB | 34 KiB/s, done.Resolving deltas: 100% (201/201), done.root@kali:/usr/share# cd tesser-bash: cd: tesser: No such file or directoryroot@kali:/usr/share# cd tessertesseract-ocr/ tesserocr/ root@kali:/usr/share# cd tesserocr/root@kali:/usr/share/tesserocr# lsLICENSE README.rst tesseract.pxd tesserocr.pyx tox.iniMANIFEST.in setup.py tesserocr_experiment.pyx testsroot@kali:/usr/share/tesserocr# python setup.py installpkg-config failed to find tesseract/lept libraries: Package tesseract was not found in the pkg-config search path.Perhaps you should add the directory containing `tesseract.pc'to the PKG_CONFIG_PATH environment variableNo package 'tesseract' foundSupporting tesseract v3.02Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 770}}Couldn't find index page for 'Cython' (maybe misspelled?)No local packages or download links found for Cython>=0.23Traceback (most recent call last): File "setup.py", line 184, in <module> setup_requires=['Cython>=0.23'], File "/usr/lib/python2.7/distutils/core.py", line 112, in setup _setup_distribution = dist = klass(attrs) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 221, in __init__ self.fetch_build_eggs(attrs.pop('setup_requires')) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 245, in fetch_build_eggs parse_requirements(requires), installer=self.fetch_build_egg File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 576, in resolve dist = best[req.key] = env.best_match(req, self, installer) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 821, in best_match return self.obtain(req, installer) # try and download/install File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 833, in obtain return installer(requirement) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 294, in fetch_build_egg return cmd.easy_install(req) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 602, in easy_install raise DistutilsError(msg)distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('Cython>=0.23')root@kali:/usr/share/tesserocr# 第四步:安装TesseractTrainer(可选用于机器学习图片生产规则)root@kali:/usr/share# git clone https://github.com/HarshUpadhyay/TesseractTrainer.git正克隆到 'TesseractTrainer'...remote: Counting objects: 421, done.Receiving objects: 100% (421/421), 98.46 KiB | 38 KiB/s, done.remote: Total 421 (delta 0), reused 0 (delta 0), pack-reused 421Resolving deltas: 100% (225/225), done.root@kali:/usr/share# cd TesseractTrainer/root@kali:/usr/share/TesseractTrainer# lsLICENSE.txt MANIFEST.in README.md README.txt setup.py tesseract_trainer WHATCHANGED.mdroot@kali:/usr/share/TesseractTrainer# python setup.py installrunning installChecking .pth file support in /usr/local/lib/python2.7/dist-packages//usr/bin/python -E -c passTEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth filesrunning bdist_eggrunning egg_infocreating TesseractTrainer.egg-infowriting requirements to TesseractTrainer.egg-info/requires.txtwriting TesseractTrainer.egg-info/PKG-INFOwriting top-level names to TesseractTrainer.egg-info/top_level.txtwriting dependency_links to TesseractTrainer.egg-info/dependency_links.txtwriting manifest file 'TesseractTrainer.egg-info/SOURCES.txt'reading manifest file 'TesseractTrainer.egg-info/SOURCES.txt'reading manifest template 'MANIFEST.in'writing manifest file 'TesseractTrainer.egg-info/SOURCES.txt'installing library code to build/bdist.linux-i686/eggrunning install_librunning build_pycreating buildcreating build/lib.linux-i686-2.7creating build/lib.linux-i686-2.7/tesseract_trainercopying tesseract_trainer/multipage_tif.py -> build/lib.linux-i686-2.7/tesseract_trainercopying tesseract_trainer/__init__.py -> build/lib.linux-i686-2.7/tesseract_trainercreating build/bdist.linux-i686creating build/bdist.linux-i686/eggcreating build/bdist.linux-i686/egg/tesseract_trainercopying build/lib.linux-i686-2.7/tesseract_trainer/multipage_tif.py -> build/bdist.linux-i686/egg/tesseract_trainercopying build/lib.linux-i686-2.7/tesseract_trainer/__init__.py -> build/bdist.linux-i686/egg/tesseract_trainerbyte-compiling build/bdist.linux-i686/egg/tesseract_trainer/multipage_tif.py to multipage_tif.pycbyte-compiling build/bdist.linux-i686/egg/tesseract_trainer/__init__.py to __init__.pyccreating build/bdist.linux-i686/egg/EGG-INFOinstalling scripts to build/bdist.linux-i686/egg/EGG-INFO/scriptsrunning install_scriptsrunning build_scriptscreating build/scripts-2.7copying and adjusting tesseract_trainer/tesstrain -> build/scripts-2.7changing mode of build/scripts-2.7/tesstrain from 644 to 755creating build/bdist.linux-i686/egg/EGG-INFO/scriptscopying build/scripts-2.7/tesstrain -> build/bdist.linux-i686/egg/EGG-INFO/scriptschanging mode of build/bdist.linux-i686/egg/EGG-INFO/scripts/tesstrain to 755copying TesseractTrainer.egg-info/PKG-INFO -> build/bdist.linux-i686/egg/EGG-INFOcopying TesseractTrainer.egg-info/SOURCES.txt -> build/bdist.linux-i686/egg/EGG-INFOcopying TesseractTrainer.egg-info/dependency_links.txt -> build/bdist.linux-i686/egg/EGG-INFOcopying TesseractTrainer.egg-info/requires.txt -> build/bdist.linux-i686/egg/EGG-INFOcopying TesseractTrainer.egg-info/top_level.txt -> build/bdist.linux-i686/egg/EGG-INFOzip_safe flag not set; analyzing archive contents...creating distcreating 'dist/TesseractTrainer-0.1-py2.7.egg' and adding 'build/bdist.linux-i686/egg' to itremoving 'build/bdist.linux-i686/egg' (and everything under it)Processing TesseractTrainer-0.1-py2.7.eggcreating /usr/local/lib/python2.7/dist-packages/TesseractTrainer-0.1-py2.7.eggExtracting TesseractTrainer-0.1-py2.7.egg to /usr/local/lib/python2.7/dist-packagesAdding TesseractTrainer 0.1 to easy-install.pth fileInstalling tesstrain script to /usr/local/binInstalled /usr/local/lib/python2.7/dist-packages/TesseractTrainer-0.1-py2.7.eggProcessing dependencies for TesseractTrainer==0.1Searching for Pillow==4.4.0.dev0Best match: Pillow 4.4.0.dev0Processing Pillow-4.4.0.dev0-py2.7-linux-i686.eggPillow 4.4.0.dev0 is already the active version in easy-install.pthInstalling viewer.py script to /usr/local/binInstalling player.py script to /usr/local/binInstalling explode.py script to /usr/local/binInstalling painter.py script to /usr/local/binInstalling pildriver.py script to /usr/local/binInstalling pilfont.py script to /usr/local/binInstalling pilprint.py script to /usr/local/binInstalling gifmaker.py script to /usr/local/binInstalling pilfile.py script to /usr/local/binInstalling pilconvert.py script to /usr/local/binInstalling enhancer.py script to /usr/local/binInstalling thresholder.py script to /usr/local/binUsing /usr/local/lib/python2.7/dist-packages/Pillow-4.4.0.dev0-py2.7-linux-i686.eggFinished processing dependencies for TesseractTrainer==0.1root@kali:/usr/share/TesseractTrainer# cd .root@kali:/usr/share/TesseractTrainer#
在测试目录下放置一个图片验证码的图片文件
测试用例使用:在测试目录下放置一个图片验证码的图片文件root@kali:~/python/laowangpy/function# lsxx.pngroot@kali:~/python/laowangpy/function# pythonPython 2.7.3 (default, Mar 14 2014, 11:57:14) [GCC 4.7.2] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import Image>>> import pytesseract>>> from pytesseract import *>>> import os>>> os.system("pwd")/root/python/laowangpy/function0>>> im = Image.open("xx.png")>>> text = image_to_string(im)Tesseract Open Source OCR Engine v3.02 with Leptonica>>> print textLP6U>>>
root@kali:~/python/laowangpy/function# pythonPython 2.7.3 (default, Mar 14 2014, 11:57:14) [GCC 4.7.2] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import Image>>> from pytesseract import *>>> im = Image.open("11.jpg")>>> text = image_to_string(im)Tesseract Open Source OCR Engine v3.02 with Leptonica>>> print texto4cKa>>>
阅读全文
0 0
- python---pytessercat图片验证码,kali linux,Pillow,pytessercat,tesserocr的安装
- Linux上安装Python的PIL和Pillow库处理图片的实例教程
- Linux上安装Python的PIL和Pillow库处理图片
- Python验证码识别 安装Pillow、tesseract-ocr与pytesseract模块的安装以及错误解决
- Python3.4的Pillow库实现验证码图片
- Linux 下Pillow的安装
- Python3 Pillow生成简单验证码图片
- Python——验证码识别 安装Pillow、tesseract-ocr与pytesseract模块的安装以及错误解决
- [python + pillow] 修改图片的尺寸
- python 的 Pillow实现图片对比
- python Pillow 处理图片
- 安装python的第三方库pillow
- win7 selenium python 验证码识别 pytesser使用 安装Pillow、pytesser、tesseract-ocr
- python安装Pillow
- python Pillow 模块安装
- python 安装Pillow
- python安装Pillow库
- Python 安装 Pillow
- 虚拟机安装windows 10 系统
- C/C++ IOCP 笔记
- Java设计模式之策略模式
- 索引的原理
- POJ 1753 Flip Game (枚举或高斯消元)
- python---pytessercat图片验证码,kali linux,Pillow,pytessercat,tesserocr的安装
- 树转二叉树
- openstack中关于报错AMQP5672拒绝连接问题
- 第012讲-第013讲 从1000个代码案例中学习人工智能和大数据实战
- while与for:渐变与星菱形
- Spring的JdbcTemplate
- leetCode-Set Matrix Zeroes
- LeetCode Text Justification
- Python ftp 上传和下载