虚拟环境包装器在终端窗口之间不持久



我成功安装了Virtualenvwrapper,并且能够在运行源代码.bashrc后使用它:唯一的问题是,如果我启动一个新的终端窗口或如果我重新启动终端,这些命令不工作。如何解决这个问题?

短答:

在.bash_profile中添加以下行:

source ~/.bashrc

长答:

默认情况下,Terminal通过/usr/bin/login启动shell,这使得shell成为登录shell。在每个平台上(不仅仅是Mac OS X), bash不使用.bashrc作为登录shell(只有/etc/profile和.bash_profile、.bash_login、.profile中存在且可读的第一个)。这就是为什么"put source ~/"。Bashrc在你的。bash_profile"是标准的建议。

(这个答案最初发布在这里:https://apple.stackexchange.com/questions/12993/why-doesnt-bashrc-run-automatically#comment13715_13019)

最新更新