简体   繁体   English

采购.bash_profile不返回

[英]Sourcing .bash_profile doesn't return

I have an access to a Dreamhost subdomain on which I'm trying to run a Django REST app. 我可以访问要在其上运行Django REST应用程序的Dreamhost子域。 The server runs on Ubuntu 12.04.5 LTS. 该服务器在Ubuntu 12.04.5 LTS上运行。 Something went wrong in my virtual environment, so I'm trying to follow Dreamhost's instructions to install Python again. 在我的虚拟环境中出了点问题,因此我试图按照Dreamhost的说明重新安装Python。 I get stuck at step 4: 我陷入第4步:

. ~/.bash_profile

The command doesn't return, and I have to interrupt it to get back. 该命令不返回,我必须中断它才能返回。 Here's my .bashrc: 这是我的.bashrc:

# ~/.bashrc: executed by bash(1) for non-login shells.

export NVM_DIR="/home/julius/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm
source .bash_profile

and here's my .bash_profile: 这是我的.bash_profile:

# ~/.bash_profile: executed by bash(1) for login shells.

umask 002
PS1='[\h]$ '
. $HOME/.bashrc
export PATH=$HOME/opt/python-3.5.1/bin:$PATH

What am I doing wrong? 我究竟做错了什么?

You have infinite recursion when loading .bashrc or .bash_profile since they both source each other. 加载.bashrc.bash_profile时,您有无限的递归,因为它们两者都是源。 You should probably remove the call to . $HOME/.bashrc 您可能应该删除对的呼叫. $HOME/.bashrc . $HOME/.bashrc to prevent this. . $HOME/.bashrc可以防止这种情况。

It never returns because it can never complete. 它永远不会返回,因为它永远无法完成。 Your .bash_profile sources your .bashrc , which in turns sources ( . s) your .bash_profile , which sources your .bashrc , which ... .bash_profile来源你.bashrc ,这在原来源( . S)你.bash_profile ,其来源你.bashrc ,这...

The bash source command (or . , which is just another name for the same thing) is not like a require or import statement that only happens once. bash source命令(或. ,只是同一事物的另一个名称)与仅发生一次的requireimport语句不同。 It is an runtime command that executes the source d file every time it's encountered. 这是一个运行时命令,每次遇到时都会执行source d文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM