美文网首页我的Python自学之路
彻底解决pycharm输入法支持有关问题

彻底解决pycharm输入法支持有关问题

作者: ASulee | 来源:发表于2016-05-01 21:33 被阅读4698次

    彻底解决pycharm输入法支持问题

    最近两一直,被pycharm的输入法困扰,在google上搜索了,各种方法也都试了,都不行。

    最后按照官网上说法进行试验,终于获得了成功。

    注:加粗的为注意的操作

    具体步骤如下:

    [maokx@localhost bin]$ vi pycharm.sh

    # ---------------------------------------------------------------------

    if [ -n "$PYCHARM_PROPERTIES" ]; then

    IDE_PROPERTIES_PROPERTY="-Didea.properties.file=\"$PYCHARM_PROPERTIES\""

    fi

    MAIN_CLASS_NAME="$PYCHARM_MAIN_CLASS_NAME"

    if [ -z "$MAIN_CLASS_NAME" ]; then

    MAIN_CLASS_NAME="com.intellij.idea.Main"

    fi

    VM_OPTIONS_FILE="$PYCHARM_VM_OPTIONS"

    if [ -z "$VM_OPTIONS_FILE" ]; then

    VM_OPTIONS_FILE="$IDE_BIN_HOME/pycharm$BITS.vmoptions"

    fi

    if [ -r "$VM_OPTIONS_FILE" ]; then

    VM_OPTIONS=`"$CAT" "$VM_OPTIONS_FILE" | "$GREP" -v "^#.*" | "$TR" '\n' ' '`

    VM_OPTIONS="$VM_OPTIONS -Djb.vmOptionsFile=\"$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=disablej2ee,disablealloc,delay=10000,sessionname=PyCharm30"

    fi

    fi

    COMMON_JVM_ARGS="\"-Xbootclasspath/a:$IDE_HOME/lib/boot.jar\" -Didea.paths.selector=PyCharm30 $IDE_PROPERTIES_PROPERTY"

    IDE_JVM_ARGS="-Didea.platform.prefix=Python -Didea.no.jre.check=true"

    ALL_JVM_ARGS="$VM_OPTIONS $COMMON_JVM_ARGS $IDE_JVM_ARGS $AGENT $REQUIRED_JVM_ARGS"

    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

    exportXMODIFIERS=@im=fcitx

    # ---------------------------------------------------------------------

    # Run the IDE.

    # ---------------------------------------------------------------------

    while true ; do

    "pycharm.sh" 183L, 5929C written

    [maokx@localhost bin]$ a^C

    [maokx@localhost bin]$ ^C

    [maokx@localhost bin]$

    就这样就可以了。

    原来,按照一般的说法:

    在~/bashrc 里面写入:

    export GTK_IM_MODULE=fcitx

    export QT_IM_MODULE=fcitx

    exportXMODIFIERS=@im=fcitx

    实验证明,这样是失败的。

    还有一种说法是:

    通过qt-config进行配置,但实验证明也是不行的。

    官方解释如下:

    GTK+ and Qt modules

    To obtain a better experience in Gtk+ and Qt programs, install thefcitx-gtk2,fcitx-gtk3,fcitx-qt4andfcitx-qt5input method modules as your need, or thefcitx-imgroup to install all of them (with the exception of fcitx-qt5 which is currently not popular).

    Add the following lines to your desktop start up script files to register the input method modules and support xim programs.

    Use.xprofileif you are using KDM, GDM, LightDM or SDDM.

    Use.xinitrcif you are using startx or Slim.

    export GTK_IM_MODULE=fcitx

    export QT_IM_MODULE=fcitx

    export XMODIFIERS=@im=fcitx

    Re-login to make these environment changes effective.

    Warning:Do NOT use.bashrcto do this. It is used for initializing an interactive bash session. It is not designed for non-interactive shell, nor for X session initialization. Moreover, setting environment variables in it can confuse diagnostic tools which are generally executed from command line so that these environment will appear as being set coorrectly for them even if they are not for the X session.

    Note:If all Qt apps have problem with fcitx, run qtconfig (qtconfig-qt4), and go to the third tab, make sure fcitx is in the "Default Input Method" combo-box.

    相关文章

      网友评论

        本文标题:彻底解决pycharm输入法支持有关问题

        本文链接:https://www.haomeiwen.com/subject/etflrttx.html