[英]Anyone know why my .bash_profile is adding "export pyenv" everytime i open terminal?
I had an issue where vscode was loading terminal in a blank screen and i got an error message in vscode saying "Unable to resolve your shell environment".我遇到了一个问题,vscode 在空白屏幕中加载终端,我在 vscode 中收到一条错误消息,提示“无法解析您的 shell 环境”。
So i decided to check my .bash_profile
file and was suprised to find it was over 700 lines where it was mainly just the following code repeated:所以我决定检查我的.bash_profile
文件,惊讶地发现它超过 700 行,主要是重复以下代码:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
I deleted the file and reopened terminal and realised everytime I open terminal, it adds the following lines:我删除了文件并重新打开终端并意识到每次打开终端时,它都会添加以下行:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
I installed pyenv straight forward following guides online so i'm not sure what time doing wrong.我按照在线指南直接安装了 pyenv,所以我不确定什么时候做错了。
If i delete .bash_profile
then reopen terminal, it recreates the .bash_profile
and adds the following code.如果我删除.bash_profile
然后重新打开终端,它会重新创建.bash_profile
并添加以下代码。
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
Anyone have any ideas how to fix this?任何人有任何想法如何解决这个问题?
Note: I also have a .zhrc
with the following exports which work as intended:注意:我还有一个.zhrc
,其中包含以下按预期工作的导出:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PATH=${PATH}:/usr/local/mysql/bin/
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
Check the other profiles that are loaded into the terminal, eg .bashrc
and .profile
(or .zshrc
and .zprofile
for zshell).检查加载到终端中的其他配置文件,例如.bashrc
和.profile
(或.zshrc
的 .zshrc 和.zprofile
)。
I had a similar issue where my .bashrc
contained a script that would add the pyenv lines to another profile every time it was run.我有一个类似的问题,我的.bashrc
包含一个脚本,每次运行时都会将 pyenv 行添加到另一个配置文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.