module: command not found
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!
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.
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.
I think that you have to put this in your script to define the module command:
module () {
eval `/usr/bin/modulecmd bash $*`
}
This was working for me
#!/bin/bash -i // it will make this interactive
精彩评论