我正在尝试为不同的 python 版本设置模块。模块安装后,大部分需要的python相关文件都是从其他服务器复制和修改的。但是当我启动python时遇到问题:
[root@rhelserver ld.so.conf.d]# module --debug add python/2.7.9
DEBUG setState: cmdline set to '/usr/local/Modules/libexec/modulecmd.tcl bash --debug add python/2.7.9'
DEBUG setConf: tcl_ext_lib set to '/usr/local/Modules/lib/libtclenvmodules.so'
DEBUG Load Tcl extension library (/usr/local/Modules/lib/libtclenvmodules.so)
DEBUG setState: tcl_ext_lib_loaded set to '1'
DEBUG setConf: siteconfig set to '/usr/local/Modules/etc/siteconfig.tcl'
DEBUG sourceSiteConfig: Source site configuration (/usr/local/Modules/etc/siteconfig.tcl)
DEBUG setState: siteconfig_loaded set to '1'
DEBUG setConf: locked_configs set to ''
DEBUG setState: shell set to 'bash'
DEBUG setState: shelltype set to 'sh'
DEBUG setState: subcmd set to 'add'
DEBUG setState: subcmd_args set to 'python/2.7.9'
DEBUG setState: init_error_report set to '1'
DEBUG setConf: verbosity set to 'debug'
DEBUG setConf: term_background set to 'dark'
DEBUG setConf: colors set to 'hi=1:db=2:tr=2:se=2:er=91:wa=93:me=95:in=94:mp=1;94:di=94:al=96:sy=95:de=4:cm=92:aL=100:L=90;47:H=2:F=41:nF=43:S=46:sS=44'
DEBUG setConf: color set to '0'
DEBUG setConf: pager set to '/usr/bin/less -eFKRX'
DEBUG setState: is_stderr_tty set to '1'
DEBUG setState: paginate set to '1'
DEBUG setState: report_format set to 'regular'
DEBUG setState: reportfd set to 'file4'
DEBUG lappendState: modulefile appended with '{}'
DEBUG module: cmd='add', args='python/2.7.9'
DEBUG setConf: avail_indepth set to '1'
DEBUG setConf: search_match set to 'starts_with'
DEBUG parseModuleCommandArgs: (show_oneperline=0, show_mtime=0, show_filter=, search_filter=, search_match=starts_with, dump_state=0, addpath_pos=prepend, not_req=0, otherargs=python/2.7.9)
DEBUG setConf: advanced_version_spec set to '0'
DEBUG setModuleVersSpec: Set module 'python/2.7.9' (escglob 'python/2.7.9'), module name 'python' (re ''), module root 'python', version cmp 'eq' and version(s) '' for argument 'python/2.7.9'
DEBUG lappendState: always_read_full_file appended with '1'
DEBUG lappendState: commandname appended with 'load'
DEBUG runModulerc: running...
DEBUG setState: rc_running set to '1'
DEBUG unsetState: rc_running unset
DEBUG cmdModuleLoad: loading python/2.7.9 (context=load, uasked=1)
DEBUG lappendState: mode appended with 'load'
DEBUG getPathToModule: finding 'python/2.7.9' in '' (report_issue=1, look_loaded=no, excdir='')
DEBUG setState: is_win set to '0'
DEBUG setState: path_separator set to ':'
DEBUG resolvStringWithEnv: '/usr/local/Modules/modulefiles' resolved to '/usr/local/Modules/modulefiles'
DEBUG setState: cwd set to '/etc/ld.so.conf.d'
DEBUG resolvStringWithEnv: '/app/ttools/module' resolved to '/app/ttools/module'
DEBUG setConf: icase set to 'never'
DEBUG setConf: extended_default set to '0'
DEBUG setConf: implicit_default set to '1'
DEBUG getModules: get 'python/2.7.9' in /usr/local/Modules/modulefiles (fetch_mtime=0, search=rc_defs_included resolve, filter=)
DEBUG findModules: finding 'python' in /usr/local/Modules/modulefiles (depthlvl=0, fetch_mtime=0)
DEBUG setConf: ignored_dirs set to 'CVS RCS SCCS .svn .git .SYNC .sos'
DEBUG findModules: found
DEBUG findModules: create cache entry '/usr/local/Modules/modulefiles:python:0:0'
DEBUG setState: inhibit_errreport set to '0'
Get modules: {} matching 'python/2.7.9' in '/usr/local/Modules/modulefiles'
DEBUG getModules: create cache entry '/usr/local/Modules/modulefiles:python/2.7.9:0:rc_defs_included resolve:'
DEBUG getModules: get 'python/2.7.9' in /app/ttools/module (fetch_mtime=0, search=rc_defs_included resolve, filter=)
DEBUG findModules: finding 'python' in /app/ttools/module (depthlvl=0, fetch_mtime=0)
DEBUG checkValidModule: /app/ttools/module/python/2.7.9
DEBUG readModuleContent: /app/ttools/module/python/2.7.9
[root@rhelserver ld.so.conf.d]#
[root@rhelserver ld.so.conf.d]#
[root@rhelserver ld.so.conf.d]# python
python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
我可以看到一些与 PKG_CONFIG 相关的环境变量在添加模块后发生了变化,但它们是如何工作的?
LOADEDMODULES="python/2.7.9"
LOADEDMODULES_modshare="python/2.7.9:1"
MANPATH="/app/vbuild/RHEL6-x86_64/python/2.7.9/share/man:/usr/local/Modules/share/man:"
MANPATH_modshare="/app/vbuild/RHEL6-x86_64/python/2.7.9/share/man:1:/usr/local/Modules/share/man:1::1"
PATH="/app/vbuild/RHEL6-x86_64/python/2.7.9/bin:/usr/lib64/qt-3.3/bin:/usr/local/Modules/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
PATH_modshare="/bin:1:/usr/sbin:1:/usr/bin:1:/usr/lib64/qt-3.3/bin:1:/usr/local/sbin:1:/app/vbuild/RHEL6-x86_64/python/2.7.9/bin:1:/usr/local/Modules/bin:1:/usr/local/bin:1:/sbin:1:/root/bin:1"
PKG_CONFIG_PATH="/app/vbuild/RHEL6-x86_64/python/2.7.9/lib/pkgconfig"
PKG_CONFIG_PATH_modshare="/app/vbuild/RHEL6-x86_64/python/2.7.9/lib/pkgconfig:1"
_LMFILES_="/app/ttools/module/python/2.7.9"
_LMFILES__modshare="/app/ttools/module/python/2.7.9:1"
pythonPATH="/app/vbuild/RHEL6-x86_64/python/2.7.9"
python2.7.9模块文件:
#%Module1.0
set software "python"
set version "2.7.9"
set description "python vbuild install"
set top /app/vbuild/RHEL6-x86_64/$software/$version
proc ModulesDisplay {} {
puts stderr "$::software-$::version : $::description"
}
proc ModulesHelp {} {
puts stderr "$::software-$::version: $::description"
}
set logger /env/common/vbuild/logger
if [file exist $logger] {
catch { source $logger }
}
prepend-path PATH $top/bin
prepend-path PKG_CONFIG_PATH $top/lib/pkgconfig
prepend-path MANPATH $top/share/man
setenv pythonPATH $top
谢谢
山姆