没有 root 权限如何使用 pip?How to install python modules without root access?
How to install python modules without root access?
參考:https://stackoverflow.com/questions/7465445/how-to-install-python-modules-without-root-access
I’m taking some university classes and have been given an ‘instructional account’, which is a school account I can ssh into to do work. I want to run my computationally intensive Numpy, matplotlib, scipy code on that machine, but I cannot install these modules because I am not a system administrator.
How can I do the installation?
Solution
In most situations the best solution is to rely on the so-called “user site” location (see the PEP for details) by running:
pip install --user package_nameBelow is a more “manual” way from my original answer, you do not need to read it if the above solution works for you.
With easy_install you can do:
easy_install --prefix=$HOME/local package_namewhich will install into
$HOME/local/lib/pythonX.Y/site-packages(the ‘local’ folder is a typical name many people use, but of course you may specify any folder you have permissions to write into).
You will need to manually create
$HOME/local/lib/pythonX.Y/site-packagesand add it to your PYTHONPATH environment variable (otherwise easy_install will complain – btw run the command above once to find the correct value for X.Y).
If you are not using easy_install, look for a prefix option, most install scripts let you specify one.
With pip you can use:
pip install --install-option="--prefix=$HOME/local" package_name總結(jié)
以上是生活随笔為你收集整理的没有 root 权限如何使用 pip?How to install python modules without root access?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SQLAlchemy 报错 NotSup
- 下一篇: kafka 串讲:架构模型、角色功能梳理