Installing pytesser

33,959

Solution 1

You should not use C:\Python27\Scripts for 3rd party modules, you should use C:\Python27\Lib\site-packages instead.

Solution 2

I'm not sure if this is the ideal solution, but this works for me. Please do correct me if this is incorrect in any way.

  1. Unzip the folder & paste it in your Python2x\Lib folder
  2. Rename it to pytesser (I'm not too sure if this is a necessary step)
  3. Duplicate the tesseract.py file and rename it as __init__.py
  4. Open __init__.py
  5. Change the line tesseract_exe_name = "tesseract" to tesseract_exe_name = 'C:\Python27\Lib\pytesser\tesseract'

Done.

Solution 3

So I'm using w10 64 bits. And it took me some time to understand how you have to install it to be able to use it.

How to :

https://code.google.com/archive/p/pytesser/downloads

download pytesser_v0.0.1.zip

unzip

move files in the project

rename import Image to "from PIL import Image" in the pytesser.py

=== Enjoy.

Solution 4

Further to Yaitzme answer - another fix you may need (I'm using Python Tools for Visual Studio on Windows 7 64-bit)...

Once I renamed the pytesser.py file to __init__ I had to put a double backslash in the line e.g.

tesseract_exe_name = ‘C:\Anaconda2\Lib\site-packages\pytesser\\tesseract’

as the single backslash '\tesseract' was interpreting the '\t' as a new tab symbol and breaking the path! Put my install instructions here

Share:
33,959
Tom M.
Author by

Tom M.

Updated on April 27, 2020

Comments

  • Tom M.
    Tom M. about 4 years

    I'm new to python and would like to install and use the pytesser OCR library. All of the other modules that I've installed, I've used easy_install, which has worked fine. But pytesser is the first that I've had to install by hand using Google Code's .zip file.

    Per the instructions in the readme (https://code.google.com/p/pytesser/wiki/README) I extracted the contexts to my C:\Python27\Scripts file. However when I try:

    from pytesser import *
    

    within the Python Shell, I get the following error:

    Traceback (most recent call last):
      File "<pyshell#2>", line 1, in <module>
        from pytesser import *
    ImportError: No module named pytesser
    

    Any ideas? Windows 7. Python 2.7. My other scripts using modules such as PIL, Scrapy, Numpy have been working fine.

    Thanks, Tom

  • wRAR
    wRAR about 11 years
    The OP tried to install the module into the system, not to import it from the local directory.
  • Samizdis
    Samizdis about 11 years
    According to code.google.com/p/pytesser/wiki/README "PyTesser has no installation functionality in this release." Therefore he needs to have the .py file in his Python path. I address this at the end of my answer. Or am I mistaken?
  • wRAR
    wRAR about 11 years
    Yes, he needs to have the .py file in his Python path and that has nothing to do with the working directory. The last part of your answer assumes you can import modules from PYTHONPATH only after you change working directory which is wrong.
  • Samizdis
    Samizdis about 11 years
    I was checking that the problem was indeed PYTHONPATH, being in the same directory works around this problem docs.python.org/2/tutorial/modules.html#the-module-search-pa‌​th
  • wRAR
    wRAR about 11 years
    Yes, now the last part is less wrong, though it is still not necessary for the original question as we know what the OP has done wrong.
  • Samizdis
    Samizdis about 11 years
    How is it at all wrong? I agree the conventional place to put 3rd party libraries is Lib\site-packages, but any module in a directory in the Python path is found.
  • wRAR
    wRAR about 10 years
    @Sekai I'd use ~/.local/lib/python2.7/site-packages (PEP-370)
  • stanleyxu2005
    stanleyxu2005 almost 10 years
    I've downloaded pytesser from google code, but there is no tesseract.py. I found it is actually python-tesseract (code.google.com/p/python-tesseract). Is it the library you've also installed?
  • user2314737
    user2314737 over 9 years
    Thanks! That worked perfectly for me too except that I had to name the init file __init__.py
  • rahulmishra
    rahulmishra over 9 years
    Additionally i had to change the line import Image to from PIL import Image
  • Danny Cullen
    Danny Cullen over 7 years
    I had to change the import for Image to from PIL import Image
  • Statham
    Statham over 7 years
    For me, the last step is 'C:/Python27/Lib/site-packages/pytesser/tesseract'
  • AskMe
    AskMe over 6 years