Installed pytesser, but can't import it

2.5k Views Asked by At

I am trying to install PyTesser to use as an OCR in my script. The README in its .zip source says:

PyTesser has no installation functionality in this release. Extract pytesser.zip into directory with other scripts.

I then extracted pytesser_v0.0.1.zip to C:\Python27\Lib\site-packages\pytesser.

However, when I try to import it in VS2013 (using from pytesser import *), I get a No module named pytesser error.

What am I doing wrong? I am using Python 2.7, by the way. I know that PIL isn't supported in Python 3+.

Thanks!

UPDATE: I found that I may be able to add modules by editing the PYTHONPATH variable, but this seems both hacky and unreliable.

UPDATE 2: Yay, I got the Tumbleweed badge!

UPDATE 3: Here are the files in C:\Python27\Lib\site-packages\pytesser:

 Directory of C:\Python27\Lib\site-packages\pytesser

16 Aug 2015  03:55 PM    <DIR>          .
16 Aug 2015  03:55 PM    <DIR>          ..
16 Aug 2015  03:55 PM               273 AUTHORS
16 Aug 2015  03:55 PM                48 ChangeLog
16 Aug 2015  03:55 PM               424 errors.py
16 Aug 2015  03:55 PM             1,410 fnord.tif
16 Aug 2015  03:55 PM            20,607 fonts_test.png
16 Aug 2015  03:55 PM               558 LICENSE
16 Aug 2015  03:55 PM               337 NOTICE
16 Aug 2015  03:55 PM            38,668 phototest.tif
16 Aug 2015  03:55 PM             2,560 pytesser.py
16 Aug 2015  03:55 PM             2,652 README
16 Aug 2015  03:55 PM    <DIR>          tessdata
16 Aug 2015  03:55 PM           827,392 tesseract.exe
16 Aug 2015  03:55 PM               669 util.py
1

There are 1 best solutions below

5
On

You do not need to edit PYTHONPATH, C:\Python27\Lib\site-packages\ is already in your PYTHONPATH. Can you list the tree that you extracted pytesser into? Under C:\Python27\Lib\site-packages\pytesser should be a file called __init__.py, my guess is that you extracted the files under an additional directory in that tree. You could also try opening a python prompt and typing import sys print sys.path To verify that C:\Python27\Lib\site-packages\ is in fact in your path.