简体   繁体   English

模块加载路径环境变量

[英]Module load-PATH-env variables

I'm currently working on a remote server (through ssh) and I need to load some modules (module load [package1][package2] ecc).我目前正在使用远程服务器(通过 ssh),我需要加载一些模块(模块加载 [package1][package2] ecc)。 Specifically, it's required the numpy version 1.15.2, but in the directory containing all the numpy versions there are only 1.14.0 versions.具体来说,需要 numpy 版本 1.15.2,但在包含所有 numpy 版本的目录中只有 1.14.0 版本。

Anyway, I was able to get the package numpy/1.15.2--python--3.6.4 (which I obviously don't have permission to copy in the directory containing the other versions of numpy) so I was wondering if I could (and how) temporarely change the enviromental variable path in order to specify, only in that case, where the "module load" should look for, instead of the usual repository like for other modules.无论如何,我能够得到 package numpy/1.15.2--python--3.6.4 (我显然没有权限在包含其他版本的 numpy 的目录中复制)所以我想知道我是否可以(以及如何)临时更改环境变量路径,以便仅在这种情况下指定“模块加载”应该查找的位置,而不是像其他模块那样的通常存储库。

temporarely change the enviromental variable path临时更改环境变量路径

I think the easiest would be to create a subshell with the modified PATH and work in that:我认为最简单的方法是使用修改后的 PATH 创建一个子shell并在其中工作:

PATH=modifiedpath bash 

Whether this works or not, depends on what exactly you are doing in your.bashrc with your PATH.这是否有效,取决于您在 .bashrc 中使用 PATH 究竟在做什么。 If you reassinged there the old PATH, your changes would be lost and in this case, you could instead do a如果您重新评估旧 PATH,您的更改将丢失,在这种情况下,您可以改为执行

PATH=modifiedpath bash --norc

to bypass soucring.bashrc.绕过 soucring.bashrc。 Of course this means aliases, functions and non-exported variables from your.bashrc aren't available either.当然,这意味着 your.bashrc 中的别名、函数和非导出变量也不可用。

If this too causes a problem, you could stay in your shell, but temporarily safe the PATH:如果这也引起了问题,您可以留在 shell 中,但暂时保护 PATH:

origpath=$PATH
PATH=modifiedpath
... do your work
PATH=$origpath # restore it

You could have your own modulepath that supersedes the modulepaths provided by the admins on the system you use.您可以拥有自己的模块路径来取代管理员在您使用的系统上提供的模块路径。

Just create a directory structure, then add your own numpy/version modulefile in it (such modulefile should define the environment variables to use your specific installation of the numpy package).只需创建一个目录结构,然后在其中添加您自己的numpy/version模块文件(此类模块文件应定义环境变量以使用您特定安装的 numpy 包)。

$ mkdir ~/modulefiles
$ mkdir ~/modulefiles/numpy
$ $EDITOR ~/modulefiles/numpy/<version>

Then enable this modulepath in your current shell session:然后在您当前的 shell session 中启用此模块路径:

$ module use ~/modulefiles

Lastly added modulepath gets higher priority, so when you will perform the module load numpy command it will load your specific numpy modulefile instead of the numpy modulefile provided by default.最后添加的模块路径具有更高的优先级,因此当您执行module load numpy命令时,它将加载您的特定 numpy 模块文件,而不是默认提供的 numpy 模块文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM