how to avoid Permission denied while installing package for Python without sudo

大憨熊 提交于 2019-11-30 03:33:53

问题


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:


try python setup.py install --user




回答2:


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


来源:https://stackoverflow.com/questions/22551461/how-to-avoid-permission-denied-while-installing-package-for-python-without-sudo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!