如何在没有root权限的情况下安装python包? [英] How to install python packages without root privileges?
问题描述
我正在使用 numpy
/scipy
/pynest
在 Mac OS X 上做一些研究计算.为了性能,我们租了一个 400-来自我们大学的节点集群(使用 Linux),以便可以并行完成任务.问题是我们不允许在集群上安装任何额外的包(没有 sudo
或任何安装工具),它们只提供原始 python 本身.
I am using numpy
/ scipy
/ pynest
to do some research computing on Mac OS X. For performance, we rent a 400-node cluster (with Linux) from our university so that the tasks could be done parallel. The problem is that we are NOT allowed to install any extra packages on the cluster (no sudo
or any installation tool), they only provide the raw python itself.
那么我如何在集群上运行我的脚本?有什么方法可以集成模块(我认为 numpy 和 scipy 也有一些已编译的二进制文件),以便可以在不安装软件包的情况下对其进行解释和执行?
How can I run my scripts on the cluster then? Is there any way to integrate the modules (numpy and scipy also have some compiled binaries I think) so that it could be interpreted and executed without installing packages?
推荐答案
您不需要 root 权限即可在您的主目录中安装软件包.您可以使用诸如
You don't need root privileges to install packages in your home directory. You can do that with a command such as
pip install --user numpy
或来源
python setup.py install --user
参见https://stackoverflow.com/a/7143496/284795
第一种选择更方便,所以如果服务器没有 pip
或 easy_install
,你应该礼貌地要求管理员添加它,解释好处给他们(他们不会再被单独包裹的请求所困扰).
The first alternative is much more convenient, so if the server doesn't have pip
or easy_install
, you should politely ask the admins to add it, explaining the benefit to them (they won't be bothered anymore by requests for individual packages).
这篇关于如何在没有root权限的情况下安装python包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!