64位ubuntu16.04下pycharm无法切换fcitx输入法和无法输入中文的问题
?
首先root權限下面輸入:
?
dpkg -l |grep fcitx
得到,看看有什么沒有安裝的:
i? fcitx?????????????????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework
ii? fcitx-bin?????????????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - essential binaries
ii? fcitx-chewing?????????????????????????????? 0.2.2-1???????????????????????????????????????????? amd64??????? Fcitx wrapper for Chewing library
ii? fcitx-config-common???????????????????????? 0.4.8-3???????????????????????????????????????????? all????????? graphic Fcitx configuration tool - common files
ii? fcitx-config-gtk??????????????????????????? 0.4.8-3???????????????????????????????????????????? amd64??????? graphic Fcitx configuration tool - Gtk+ 3 version
ii? fcitx-data????????????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - essential data files
ii? fcitx-frontend-all????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - frontends metapackage
ii? fcitx-frontend-gtk2???????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - GTK+ 2 IM Module frontend
ii? fcitx-frontend-gtk3???????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - GTK+ 3 IM Module frontend
ii? fcitx-frontend-qt4????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - Qt4 IM Module frontend
ii? fcitx-frontend-qt5:amd64??????????????????? 1.0.5-1???????????????????????????????????????????? amd64??????? Free Chinese Input Toy of X - Qt5 IM Module frontend
ii? fcitx-libs????????????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? transitional dummy package
ii? fcitx-libs-qt?????????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? transitional dummy package
ii? fcitx-module-cloudpinyin:amd64????????????? 0.3.4-3???????????????????????????????????????????? amd64??????? Flexible Input Method Framework - cloudpinyin module
ii? fcitx-module-dbus?????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - D-Bus module and IPC frontend
ii? fcitx-module-kimpanel?????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - KIMPanel protocol module
ii? fcitx-module-lua??????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - Lua module
ii? fcitx-module-x11??????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - X11 module and XIM frontend
ii? fcitx-modules?????????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - core modules
ii? fcitx-pinyin??????????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - classic Pinyin engine
ii? fcitx-sunpinyin???????????????????????????? 0.4.1-2build1?????????????????????????????????????? amd64??????? fcitx wrapper for Sunpinyin IM engine
ii? fcitx-table???????????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - table engine
ii? fcitx-table-all???????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - tables metapackage
ii? fcitx-table-bingchan??????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - Bingchan table
ii? fcitx-table-cangjie???????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - Cangjie table
ii? fcitx-table-dianbaoma?????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - Dianbaoma table
ii? fcitx-table-erbi??????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - Erbi table
ii? fcitx-table-wanfeng???????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - Wanfeng table
ii? fcitx-table-wbpy??????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - WubiPinyin table
ii? fcitx-table-wubi??????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - Wubi table
ii? fcitx-table-ziranma???????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? all????????? Flexible Input Method Framework - Ziranma table
ii? fcitx-ui-classic??????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - Classic user interface
ii? fcitx-ui-qimpanel?????????????????????????? 2.1.2-1???????????????????????????????????????????? amd64??????? Flexible Input Method Framework - Qt IMPanel user interface
ii? libfcitx-config4:amd64????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - configuration support library
ii? libfcitx-core0:amd64??????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - library of core funtions
ii? libfcitx-gclient0:amd64???????????????????? 1:4.2.9.1-1ubuntu1????????????????????????????????? amd64??????? Flexible Input Method Framework - D-Bus client library for Glib
ii? libfcitx-qt0:amd64????????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - Meta package for Qt library
ii? libfcitx-qt5-1:amd64??????????????????????? 1.0.5-1???????????????????????????????????????????? amd64??????? Free Chinese Input Toy of X - D-Bus client libraries for Qt5
ii? libfcitx-utils0:amd64?????????????????????? 1:4.2.9.1-1ubuntu1.16.04.2????????????????????????? amd64??????? Flexible Input Method Framework - utility support library
然后注意pycharm.sh中環境變量的添加位置,注意千萬不要把fcitx
相關的三行添加到最后,那樣就無效了。正確的添加方法如下(下面
是確保fcitx可以在pycharm中切換出來并且可以輸入中文的整個
pycharm.sh的內容):
?
gedit /home/appleyuchi/Downloads/pycharm-2017.1.2/bin/pycharm.sh
內容為(注意紅色字體添加的具體位置,添加位置出錯則直接導致無效):
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
#
# ---------------------------------------------------------------------
# PyCharm startup script.
# ---------------------------------------------------------------------
#
message()
{
? TITLE="Cannot start PyCharm"
? if [ -n "`which zenity`" ]; then
??? zenity --error --title="$TITLE" --text="$1"
? elif [ -n "`which kdialog`" ]; then
??? kdialog --error "$1" --title "$TITLE"
? elif [ -n "`which xmessage`" ]; then
??? xmessage -center "ERROR: $TITLE: $1"
? elif [ -n "`which notify-send`" ]; then
??? notify-send "ERROR: $TITLE: $1"
? else
??? echo "ERROR: $TITLE\n$1"
? fi
}
isJDK()
{
? if [ -z $1 ] || [ ! -x "$1/bin/java" ]; then
??? return 1
? else
??? return 0
? fi
}
UNAME=`which uname`
GREP=`which egrep`
GREP_OPTIONS=""
CUT=`which cut`
READLINK=`which readlink`
XARGS=`which xargs`
DIRNAME=`which dirname`
MKTEMP=`which mktemp`
RM=`which rm`
CAT=`which cat`
TR=`which tr`
if [ -z "$UNAME" -o -z "$GREP" -o -z "$CUT" -o -z "$MKTEMP" -o -z "$RM" -o -z "$CAT" -o -z "$TR" ]; then
? message "Required tools are missing - check beginning of \"$0\" file for details."
? exit 1
fi
OS_TYPE=`"$UNAME" -s`
# ---------------------------------------------------------------------
# Ensure IDE_HOME points to the directory where the IDE is installed.
# ---------------------------------------------------------------------
SCRIPT_LOCATION=$0
if [ -x "$READLINK" ]; then
? while [ -L "$SCRIPT_LOCATION" ]; do
??? SCRIPT_LOCATION=`"$READLINK" -e "$SCRIPT_LOCATION"`
? done
fi
IDE_BIN_HOME=`dirname "$SCRIPT_LOCATION"`
if [ "$IDE_BIN_HOME" = "." ]; then
? IDE_HOME=".."
else
? IDE_HOME=`dirname "$IDE_BIN_HOME"`
fi
# ---------------------------------------------------------------------
# Locate a JDK installation directory which will be used to run the IDE.
# Try (in order): PYCHARM_JDK, pycharm.jdk, ../jre, JDK_HOME, JAVA_HOME, "java" in PATH.
# ---------------------------------------------------------------------
JDK=""
if isJDK $PYCHARM_JDK; then
? JDK="$PYCHARM_JDK"
fi
if [ "$JDK" = "" ] && [ -s "$HOME/.PyCharm2017.1/config/pycharm.jdk" ]; then
? JDK=`"$CAT" $HOME/.PyCharm2017.1/config/pycharm.jdk`
? if [ ! -d "$JDK" ]; then
??? JDK="$IDE_HOME/$JDK"
? fi
? if ! isJDK $JDK; then
??? JDK=""
? fi
fi
if [ "$JDK" = "" ] && [ "$OS_TYPE" = "Linux" ] &&
?? [ -x "$IDE_HOME/jre64/bin/java" ] && "$IDE_HOME/jre64/bin/java" -version > /dev/null 2>&1 ; then
? JDK="$IDE_HOME/jre64"
fi
if [ "$JDK" = "" ] && isJDK $JDK_HOME; then
? JDK="$JDK_HOME"
fi
if [ "$JDK" = "" ]; then
? if isJDK $JAVA_HOME; then
??? JDK="$JAVA_HOME"
? else
??? JAVA_BIN_PATH=`which java`
??? if [ -n "$JAVA_BIN_PATH" ]; then
????? if [ "$OS_TYPE" = "FreeBSD" -o "$OS_TYPE" = "MidnightBSD" ]; then
??????? JAVA_LOCATION=`JAVAVM_DRYRUN=yes java | "$GREP" '^JAVA_HOME' | "$CUT" -c11-`
??????? if [ -x "$JAVA_LOCATION/bin/java" ]; then
????????? JDK="$JAVA_LOCATION"
??????? fi
????? elif [ "$OS_TYPE" = "SunOS" ]; then
??????? JAVA_LOCATION="/usr/jdk/latest"
??????? if [ -x "$JAVA_LOCATION/bin/java" ]; then
????????? JDK="$JAVA_LOCATION"
??????? fi
????? elif [ "$OS_TYPE" = "Darwin" ]; then
??????? JAVA_LOCATION=`/usr/libexec/java_home`
??????? if [ -x "$JAVA_LOCATION/bin/java" ]; then
????????? JDK="$JAVA_LOCATION"
??????? fi
????? fi
??? fi
??? if [ -z "$JDK" -a -x "$READLINK" -a -x "$XARGS" -a -x "$DIRNAME" ]; then
????? JAVA_LOCATION=`"$READLINK" -f "$JAVA_BIN_PATH"`
????? case "$JAVA_LOCATION" in
??????? */jre/bin/java)
????????? JAVA_LOCATION=`echo "$JAVA_LOCATION" | "$XARGS" "$DIRNAME" | "$XARGS" "$DIRNAME" | "$XARGS" "$DIRNAME"`
????????? if [ ! -d "$JAVA_LOCATION/bin" ]; then
??????????? JAVA_LOCATION="$JAVA_LOCATION/jre"
????????? fi
????????? ;;
??????? *)
????????? JAVA_LOCATION=`echo "$JAVA_LOCATION" | "$XARGS" "$DIRNAME" | "$XARGS" "$DIRNAME"`
????????? ;;
????? esac
????? if [ -x "$JAVA_LOCATION/bin/java" ]; then
??????? JDK="$JAVA_LOCATION"
????? fi
??? fi
? fi
fi
JAVA_BIN="$JDK/bin/java"
if [ ! -x "$JAVA_BIN" ]; then
? JAVA_BIN="$JDK/jre/bin/java"
fi
if [ -z "$JDK" ] || [ ! -x "$JAVA_BIN" ]; then
? message "No JDK found. Please validate either PYCHARM_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation."
? exit 1
fi
VERSION_LOG=`"$MKTEMP" -t java.version.log.XXXXXX`
JAVA_TOOL_OPTIONS= "$JAVA_BIN" -version 2> "$VERSION_LOG"
"$GREP" "64-Bit|x86_64|amd64" "$VERSION_LOG" > /dev/null
BITS=$?
"$RM" -f "$VERSION_LOG"
test ${BITS} -eq 0 && BITS="64" || BITS=""
# ---------------------------------------------------------------------
# Collect JVM options and IDE properties.
# ---------------------------------------------------------------------
if [ -n "$PYCHARM_PROPERTIES" ]; then
? IDE_PROPERTIES_PROPERTY="-Didea.properties.file=$PYCHARM_PROPERTIES"
fi
VM_OPTIONS_FILE=""
if [ -n "$PYCHARM_VM_OPTIONS" -a -r "$PYCHARM_VM_OPTIONS" ]; then
? # explicit
? VM_OPTIONS_FILE="$PYCHARM_VM_OPTIONS"
elif [ -r "$HOME/.PyCharm2017.1/pycharm$BITS.vmoptions" ]; then
? # user-overridden
? VM_OPTIONS_FILE="$HOME/.PyCharm2017.1/pycharm$BITS.vmoptions"
elif [ -r "$IDE_BIN_HOME/pycharm$BITS.vmoptions" ]; then
? # default, standard installation
? VM_OPTIONS_FILE="$IDE_BIN_HOME/pycharm$BITS.vmoptions"
else
? # default, universal package
? test "$OS_TYPE" = "Darwin" && OS_SPECIFIC="mac" || OS_SPECIFIC="linux"
? VM_OPTIONS_FILE="$IDE_BIN_HOME/$OS_SPECIFIC/pycharm$BITS.vmoptions"
fi
VM_OPTIONS=""
if [ -r "$VM_OPTIONS_FILE" ]; then
? VM_OPTIONS=`"$CAT" "$VM_OPTIONS_FILE" | "$GREP" -v "^#.*"`
else
? message "Cannot find VM options file"
fi
IS_EAP="false"
if [ "$IS_EAP" = "true" ]; then
? OS_NAME=`echo "$OS_TYPE" | "$TR" '[:upper:]' '[:lower:]'`
? AGENT_LIB="yjpagent-$OS_NAME$BITS"
? if [ -r "$IDE_BIN_HOME/lib$AGENT_LIB.so" ]; then
??? AGENT="-agentlib:$AGENT_LIB=disablealloc,delay=10000,probe_disable=*,sessionname=PyCharm2017.1"
? fi
fi
CLASSPATH="$IDE_HOME/lib/bootstrap.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/extensions.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/util.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/jdom.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/log4j.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/trove4j.jar"
CLASSPATH="$CLASSPATH:$IDE_HOME/lib/jna.jar"
if [ -n "$PYCHARM_CLASSPATH" ]; then
? CLASSPATH="$CLASSPATH:$PYCHARM_CLASSPATH"
fi
export CLASSPATH
LD_LIBRARY_PATH="$IDE_BIN_HOME:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
# ---------------------------------------------------------------------
# Run the IDE.
# ---------------------------------------------------------------------
IFS="$(printf '\n\t')"
LD_LIBRARY_PATH="$IDE_BIN_HOME:$LD_LIBRARY_PATH" "$JAVA_BIN" \
? ${AGENT} \
? "-Xbootclasspath/a:$IDE_HOME/lib/boot.jar" \
? -classpath "$CLASSPATH" \
? ${VM_OPTIONS} \
? "-XX:ErrorFile=$HOME/java_error_in_PYCHARM_%p.log" \
? "-XX:HeapDumpPath=$HOME/java_error_in_PYCHARM.hprof" \
? -Didea.paths.selector=PyCharm2017.1 \
? "-Djb.vmOptionsFile=$VM_OPTIONS_FILE" \
? ${IDE_PROPERTIES_PROPERTY} \
? -Didea.platform.prefix=Python \
? com.intellij.idea.Main \
? "$@"
?
?
?
改完pycharm.sh文件后,保存后,重啟pycharm,就可以生效了。
?
參考鏈接:
http://blog.csdn.net/maokexu123/article/details/44515019
?
?
?
?
?
?
總結
以上是生活随笔為你收集整理的64位ubuntu16.04下pycharm无法切换fcitx输入法和无法输入中文的问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 改变libreoffice的writer
- 下一篇: 按行拼接两个txt文件的python实现