打开终端时Python源激活出现“不是有效标识符”错误

2 投票
1 回答
1732 浏览
提问于 2025-04-18 06:38

我正在使用Mac OS X v10.9.2。当我登录到我的终端时,立刻看到以下内容:

Last login: Wed May 14 22:45:00 on ttys007
-bash: export: `/Users/NabilKaz/Library/Enthought/Canopy_64bit/User/bin/activate': not a valid identifier

我使用的是Enthought Canopy,我猜它是在激活一个Python虚拟环境?

这是我的.bash_profile文件的内容:

export PATH="/usr/local/mysql/bin:$PATH"L_ENV_DISABLE_PROMPT=1 source /Users/NabilKaz/Library/Enthought/Canopy_64bit/User/bin/activate


[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# Added by Canopy installer on 2014-02-19
# VIRTUAL_ENV_DISABLE_PROMPT can be set to '' to make bashprompt show that Canopy is active, otherwise 1
VIRTUAL_ENV_DISABLE_PROMPT=1 source /Users/NabilKaz/Library/Enthought/Canopy_64bit/User/bin/activate

1 个回答

0

这一行:

export PATH="/usr/local/mysql/bin:$PATH"L_ENV_DISABLE_PROMPT=1 source /Users/NabilKaz/Library/Enthought/Canopy_64bit/User/bin/activate

应该是

export PATH="/usr/local/mysql/bin:$PATH"
L_ENV_DISABLE_PROMPT=1 source /Users/NabilKaz/Library/Enthought/Canopy_64bit/User/bin/activate

撰写回答