每当我在 tmux 或 screen 会话中使用 Tensorflow(一个 Python 库)时,我都必须手动更改环境变量。具体来说,我必须输入export PATH blah blah blah
和export LD_LIBRARY_PATH blah blah blah
。通常(在 tmux 和 screen 之外)我不需要这样做,因为我的 .bashrc 包含正是这些行。
奇怪的是,由于某种原因,source ~/.bashrc
从 tmux 或 screen 运行不会更新路径变量。我也尝试添加source ~/.bashrc
到我的.profile
.所以,我的问题是,我需要做什么才能让 tmux 和 screen 自动运行我的两条导出线?
编辑:运行后set -x; source ~/.bashrc
,打印输出的末尾显示:
++ export 'PATH=/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}'
++ PATH='/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}'
++ export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64:/home/ajherman/arrayfire-3/lib:/home/ajherman/arrayfire-3/lib
++ LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64:/home/ajherman/arrayfire-3/lib:/home/ajherman/arrayfire-3/lib
++ bind TAB:menu-complete
++ export 'PATH=/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}'
++ PATH='/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}'
++ export 'PATH=/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}}'
++ PATH='/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}}'
++ export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64:/home/ajherman/arrayfire-3/lib:/home/ajherman/arrayfire-3/lib
++ LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64:/home/ajherman/arrayfire-3/lib:/home/ajherman/arrayfire-3/lib