module: command not found

删除回忆录丶 提交于 2020-06-10 18:55:13

问题


I'm attempting to load several modules for building a library on Linux but am told that the command 'module' doesn't exist. I've Googled around and discovered that the solution was to source a directory called "module" which I am unable to locate despite extensive searching.

I'm not quite sure what I should and any help would be appreciated (it might help to know that the makefile I'm working with uses csh while my default shell is bash). Thanks!


回答1:


I tried to reproduce it and it turns out that for me sourcing

source /etc/profile.d/modules.sh

in th .sh script helps for bash and similar. For csh and tcsh, you have to add

source /etc/profile.d/modules.csh

to the script. Note, that this line must come first and then the

module load foo

line.




回答2:


I got here as I was searching for ways to install multiple php versions in CentOS7 and https://blog.remirepo.net/post/2019/05/22/PHP-7.4-as-Software-Collection was one of the articles I tried to follow and encountered the same "module: command not found" issue.

Sourcing /etc/profile via command:

. /etc/profile

seems to make the "module load" work.

Credits to fadishei in https://forums.fedoraforum.org/showthread.php?262708-module-command-not-found

To make the version of php (e.g. php7.4) persist, append the following to file /etc/profile.d/custom.sh

source /etc/profile.d/modules.sh
module load php74

Reboot and run the php --version to cross-check that php 7.4 is the current version installed.




回答3:


I think that you have to put this in your script to define the module command:

module () {
    eval `/usr/bin/modulecmd bash $*`
}


来源:https://stackoverflow.com/questions/2257854/module-command-not-found

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