一旦我 ssh 进入我的 ubuntu,我的 PYTHONPATH 就会显示
:/usr/local/opencv-2.4.13/build/modules/python:/usr/local/mxnet/python:/usr/local/caffe/python
我不想要这些起始设置,但我不知道它们是如何设置的。它们未在 .bashrc 或 .profile 中设置。我还应该去哪里看?
最佳答案
要检查的位置列表(这包括这些文件中的任何一个源或运行的脚本,这意味着在此文件列表中为有问题的变量提供 grep
是不够的):
/etc/profile
文件夹
/etc/profile.d/
中的所有文件/etc/environment
~/.bash_profile, ~/.bash_login, and ~/.profile
的第一个现有文件/etc/bash.bashrc (or /etc/bashrc , depending on OS)
~/.bashrc
~/.pam_environment (when using ssh)
/etc/motd (when using ssh)
解释:
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist. This may be inhibited by using the --norc option.
The contents of /etc/motd are displayed by pam_motd(8) after a successful login but just before it executes the login shell. The abbreviation "motd" stands for "message of the day", and this file has been traditionally used for exactly that (it requires much less disk space than mail to all users). On Debian GNU/Linux, the content of /run/motd.dynamic is also displayed. This file is generated by /etc/init.d/motd at boot.
关于bash - 无法弄清楚我如何在 Ubuntu 中设置我的 PYTHONPATH,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51601059/