23

I am trying to install the tesseract wrapper for python as user mike so that I can import tesseract. I'm following the guide here https://code.google.com/p/python-tesseract/wiki/HowToCompilePythonTesseractForCentos

However, when I execute python setup.py install

I get the error below:

    [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/test-easy-install-7351.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib/python2.7/site-packages/

I do have sudo access but here is the problem: When I login as root the default python version is 2.6, however, when I login as mike the default python version is 2.7 (this is the one I want). So if I do sudo python setup.py install then the installation for tesseract is taking place on 2.6 rather than on 2.7.

What can I do in this scenario? Should I change permissions on the site-packages folder? I'm a bit out of options...

1

2 Answers 2

58

try python setup.py install --user

This will install the package on /home/your_user/.local/lib/pythonX.X/site-packages/ instead of /usr/local/lib/ where you don't have permissions (unless you use sudo).

4
  • that got me over the bump but not fully there yet. now I get this error error: could not create 'build/bdist.linux-x86_64/egg': Permission denied
    – Anthony
    Mar 21, 2014 at 11:56
  • 4
    probably because you've already build package as root. You need to chown buuild dir to yourself. Or remove it and compile again.
    – m.wasowski
    Mar 21, 2014 at 12:01
  • 1
    @Will it installs a module from source code in userspace (setup.py is provided by module authors)
    – m.wasowski
    Jan 27, 2016 at 16:46
  • works for me .. it intalled all packages in /home/user/.local/ .. great !! thanks
    – shiva
    Oct 17, 2016 at 8:03
3

Maybe you can type this line as normal user:

whereis python

Assume the result is "/usr/bin/python", then:

sudo /usr/bin/python setup.py install
2
  • python2.7 isn't found as sudo
    – Anthony
    Mar 21, 2014 at 11:55
  • is "python2.7" found as normal user? What about try "whereis python" to find 2.7 version
    – ZZY
    Mar 21, 2014 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.