编辑:澄清此解决方法适用于PyCharm 2016.3.0
真的建议您只运行以下命令
source ~/.bash_profile
在每个终端会话开始时,直到 2016.3.1 发布。
但是,有一个解决此错误的方法。终端脚本似乎有 2 个函数名称颠倒了,因此必须重命名它们。
您必须编辑应用程序的终端插件脚本才能执行此操作,不推荐这样做。
在 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,您应该一切顺利。