编辑:澄清此解决办法是PyCharm 2016.3.0
这真的建议你只在每个终端会话开始运行以下命令
source ~/.bash_profile
,直到2016年3月1日发行了。
但是,这种错误有一个解决方法。终端脚本似乎有两个函数名称反转,所以它们必须重命名。
你必须编辑应用程序的终端插件脚本来做到这一点,这是不推荐。
MacOSX上,这个坐落在这里,如果全球的装机量PyCharm(不知道在哪里,否则):
cd /Applications/PyCharm.app/Contents/plugins/terminal
编辑“jediterm-bash.in”文件与您所选择的文本处理器。 如果应该是这样的:
#!/bin/bash
function load_login_configs {
# When bash is invoked as an interactive login shell, or as a non-interac-
# tive 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.
if [ -f /etc/profile ]; then
source /etc/profile
fi
if [ -f ~/.bash_profile ]; then
source ~/.bash_profile
else
if [ -f ~/.bash_login ]; then
source ~/.bash_login
else
if [ -f ~/.profile ]; then
source ~/.profile
fi
fi
fi
}
function load_interactive_configs {
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
}
if [ `shopt -q login_shell` ]; then
load_login_configs
fi
load_interactive_configs
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
bind '"\e\e[C":forward-word'
bind '"\e\e[D": backward-word'
bind '"\e\O[C":forward-word'
bind '"\e\O[D": backward-word'
function generate_command_executed_sequence() {
printf '\e\7'
}
export -f generate_command_executed_sequence
#generate escape sequence after command is executed to notify jediterm emulator
trap "generate_command_executed_sequence" DEBUG
if [ -n "$JEDITERM_USER_RCFILE" ]
then
source $JEDITERM_USER_RCFILE
fi
if [ -n "$JEDITERM_SOURCE" ]
then
source $JEDITERM_SOURCE
fi
重命名下列功能:
load_login_configs
=>load_interactive_configs
load_interactive_configs
=>load_login_configs
最终的脚本应该是:
#!/bin/bash
function load_interactive_configs {
# When bash is invoked as an interactive login shell, or as a non-interac-
# tive 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.
if [ -f /etc/profile ]; then
source /etc/profile
fi
if [ -f ~/.bash_profile ]; then
source ~/.bash_profile
else
if [ -f ~/.bash_login ]; then
source ~/.bash_login
else
if [ -f ~/.profile ]; then
source ~/.profile
fi
fi
fi
}
function load_login_configs {
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
}
if [ `shopt -q login_shell` ]; then
load_login_configs
fi
load_interactive_configs
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
bind '"\e\e[C":forward-word'
bind '"\e\e[D": backward-word'
bind '"\e\O[C":forward-word'
bind '"\e\O[D": backward-word'
function generate_command_executed_sequence() {
printf '\e\7'
}
export -f generate_command_executed_sequence
#generate escape sequence after command is executed to notify jediterm emulator
trap "generate_command_executed_sequence" DEBUG
if [ -n "$JEDITERM_USER_RCFILE" ]
then
source $JEDITERM_USER_RCFILE
fi
if [ -n "$JEDITERM_SOURCE" ]
then
source $JEDITERM_SOURCE
fi
保存并重新启动PyCharm,你应该很好去。
请参阅http://stackoverflow.com/q/135688/104891。 GUI应用程序不会读取'.bash_profile'。 – CrazyCoder
呃......好像每个版本的OS X都以不同的方式处理这个问题...... – CLJ