编辑:澄清这个解决方法适用于 PyCharm 2016.3.0
建议您只运行以下命令
source ~/.bash_profile
直到2016.3.1版本发布前,在每个终端会话开始时都需要执行此操作。
然而,这个 bug 有一个解决方法。终端脚本似乎将两个函数名反转了,因此它们必须被重命名。
你需要编辑应用程序的终端插件脚本来完成此操作,但不建议这样做。
在 MacOSX 上,如果 PyCharm 是全局安装的(否则不确定在哪里),可以在此处找到:
cd /Applications/PyCharm.app/Contents/plugins/terminal
用您选择的文本处理器编辑“jediterm-bash.in”文件。它应该看起来像这样:
#!/bin/bash
function load_login_configs {
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
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
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 {
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
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
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,然后您就可以开始使用了。