30

module: command not found

 4 years ago
source link: https://www.tuicool.com/articles/AFfU7bA
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

module是*nix系统上加载/管理模块的命令,然而大多数发行版上并未默认安装,运行该命令则会出现如下错误: module: command not found

解决办法是用 root 身份安装软件包,CentOS的安装命令是: sudo yum install -y environment-modules ,Ubuntu上则是: sudo apt-get install environment-modules 。安装完成后,已打开的终端要重新打开,命令才能生效。

module命令的常用子命令有:

  • avail :查看可用模块
  • add/load :加载模块
  • rm/unload :卸载模块
  • update/refresh :重新加载模块
  • swap/switch :用新模块替换已加载模块
  • clear/purge :清空模块
  • list :列出已加载的模块
  • show/display :显示模块信息

type 命令可以参看 module 的定义,可知其为 modulecmd 定义的shell函数:

$ which module
# 输出:
# /usr/bin/which: no module in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

$ type module
# 输出:
# module is a function
# module ()
# {
#    eval `/usr/bin/modulecmd bash $*`
# }

参考

  1. “module load” command does not work
  2. module(1) – Linux man page

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK