NS2安装过程中环境变量设置的问题(ns-2.35)

时间:2023-03-09 02:15:03
NS2安装过程中环境变量设置的问题(ns-2.35)
nam: Can't find a usable tk.tcl in the following directories:
*/ns-allinone-2.35/tcl8.5.10/library/tk8.5 */ns-allinone-2.35/tcl8.5.10/tk8.5 ./lib/tk8.5 */ns-allinone-2.35/lib/tk8.5 ./library */ns-allinone-2.35/lib/tk8.5/tk.tcl: wrong # args: should be "::source fileName"
wrong # args: should be "::source fileName"
while executing
"::source -encoding utf-8 */ns-allinone-2.35/lib/tk8.5/msgs/en.msg"
("uplevel" body line 1)
invoked from within
"uplevel 1 [list ::source -encoding utf-8 $langfile]"
(procedure "::msgcat::mcload" line 10)
invoked from within
"::msgcat::mcload [file join $::tk_library msgs]"
(in namespace eval "::tk::msgcat" script line 23)
invoked from within
"namespace eval msgcat {
namespace export mc mcmax
if {[interp issafe] || [catch {package require msgcat}]} {
# The msgcat package..."
(in namespace eval "::tk" script line 3)
invoked from within
"namespace eval ::tk {
# Set up the msgcat commands
namespace eval msgcat {
namespace export mc mcmax
if {[interp issafe] || [catch {p..."
(file "*/ns-allinone-2.35/lib/tk8.5/tk.tcl" line 21)
invoked from within
"source.orig */ns-allinone-2.35/lib/tk8.5/tk.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig [list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig [list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source */ns-allinone-2.35/lib/tk8.5/tk.tcl"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list source $file]"

在安装ns2的过程中遇到这个错误,在查找了很多资料后才找到解决问题的办法:
在TCL_LIBRARY中添加值$NS_HOME/ns-allinone-2.35/tk8.5.10/library
即修改TCL_LIBRARY为TCL_LIBRARY=$NS_HOME/ns-allinone-2.35/tcl8.5.10/library:$NS_HOME/ns-allinone-2.35/tk8.5.10/library
然后source ~/.bashrc
其中$NS_HOME是ns2的路径

下面附带我的环境变量设置:

export NS_HOME=/data/ns2/ns-allinone-2.3.5
export PATH=$NS_HOME/bin:$NS_HOME/tcl8.5.10/unix:$NS_HOME/tk8.5.10/unix:$PATH
export LD_LIBRARY_PATH=$NS_HOME/otcl-1.14:$NS_HOME/lib
export TCL_LIBRARY=$NS_HOME/tcl8.5.10/library:$NS_HOME/tk8.5.10/library