How to avoid Permission denied when installing a package for Python without sudo

I am trying to install a shell tesseractfor python as user mikeso that I can import tesseract. I follow the guide here https://code.google.com/p/python-tesseract/wiki/HowToCompilePythonTesseractForCentos

However, when I perform python setup.py install

I get an error message 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 have sudo access, but here's the problem: when I log in as root, the default python version is 2.6, however when I log in as mike, the default python version 2.7(this is the one I want). Therefore, if I do sudo python setup.py install, then the installation for tesseractoccurs on 2.6, not on 2.7.

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

+4
source share
2 answers

try python setup.py install --user

+12
source

Perhaps you can enter this line as a regular user:

whereis python

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

sudo /usr/bin/python setup.py install
+2
source

Source: https://habr.com/ru/post/1532769/


All Articles