亲宝软件园·资讯

展开

Loongnix安装PyCharm Community Loongnix安装PyCharm Community 2020.2.3的教程详解

DexterLien 人气:0

安装java运行环境

Loongnix官方仓库里面的openjdk1.8.0_212版本, 已经测试通过

$ sudo yum install -y java-latest-openjdk
$ java -version
# openjdk version "1.8.0_212"

下载程序包

官网下载地址:
https://www.jetbrains.com/pycharm/download/other.html

本文撰写时使用的是Linux2020.2.3版本tar.gz格式压缩包

解压程序包并运行

$ tar -zxvf pycharm-community-2020.2.3.tar.gz
$ cd pycharm-community-2020.2.3
$ ./bin/pycharm.sh

手动启动正常, 没有报错

添加快捷方式到xfce4的程序菜单中

$ vim ~/.local/share/applications/jetbrains-pycharm-ce.desktop

编辑内容如下:

[Desktop Entry]
Version=1.0
Type=Application
Name=Pycharm Community Edition
Icon=/home/lpwm/Apps/pycharm-community-2020.2.3/bin/pycharm.png
Exec="/home/lpwm/Apps/pycharm-community-2020.2.3/bin/pycharm.sh" %f
Comment=人生苦短,我用Python
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-pycharm-ce

解决Terminal无法启动问题

在PyCharm中打开Terminal面板遇到了错误:

在这里插入图片描述

查看了下~/.cache/JetBrains/PyCharmCE2020.2/log/idea.log日志

Suppressed: java.io.IOException: Native library (home/lpwm/Apps/pycharm-community-2020.2.3/lib/pty4j-native/linux/x86_64/libpty.so) not found in resource path (/home/lpwm/Apps/pycharm-community-2020.2.3/lib/bootstrap.jar:/home/lpwm/Apps/pycharm-community-2020.2.3/lib/extensions.jar:/home/lpwm/Apps/pycharm-community-2020.2.3/lib/util.jar:/home/lpwm/Apps/pycharm-community-2020.2.3/lib/jdom.jar:/home/lpwm/Apps/pycharm-community-2020.2.3/lib/log4j.jar:/home/lpwm/Apps/pycharm-community-2020.2.3/lib/trove4j.jar:/home/lpwm/Apps/pycharm-community-2020.2.3/lib/jna.jar)

调用lib/pty4j-native/linux/x86_64/libpty.so的时候出现了问题,关键是我这是MIPS64架构,看来还得动手解决了,参考stackoverflow上的这个问题进行解决:https://stackoverflow.com/questions/62850986/pycharm-terminal-not-working-on-raspbian-os

主要过程就是从JetBrains官方的git仓库中克隆pty4j代码,在本地使用gcc编译libpty.so动态链接文件(类似于Windows 中的DLL文件),最后用编译的so文件替换之前的x86_64架构适用的文件

$ sudo yum install -y git
$ git clone https://github.com/JetBrains/pty4j.git
$ cd pty4j/native
$ gcc -fPIC -c *.c
$ gcc -shared -o libpty.so *.o
$ rm /home/lpwm/Apps/pycharm-community-2020.2.3/lib/pty4j-native/linux/x86_64/libpty.so
$ cp libpty.so /home/lpwm/Apps/pycharm-community-2020.2.3/lib/pty4j-native/linux/x86_64/

搞定后重启一下PyCharm,再开Terminal面板就正常了

在这里插入图片描述

解决External file changes sync may be slow问题

跟上面的问题类似,PyCharm官方对非x86平台的支持并不完美,还是需要手工编译相关的依赖,这里需要手工编译一个叫fsnotifier的应用,官方文档:https://confluence.jetbrains.com/display/IDEADEV/Compiling+File+Watcher

按照官方文档上说的流程进行编译,结果不出意外的悲剧了,报错

[lpwm@sugon fix]$ sh make.sh 
*** Compiling platform-specific version (fsnotifier-mips64)...
main.c: 在函数‘report_event'中:
main.c:436:16: 警告:initialization discards ‘const' qualifier from pointer target type
  char* copy = path, *p;
        ^

不过倒是生成了fsnotifier-mips64二进制文件,貌似没影响吧,继续后面的操作

$ cp fsnotifier-mips64 ~/Apps/pycharm-community-2020.2.3/bin/

重新启动PyCharm, 点击菜单栏中的Help-Edit Custom Properties,提示创建idea.properties配置文件,写入下面内容

idea.filewatcher.executable.path = fsnotifier-mips64

重启PyCharm, 欧耶!没有提示了!

加载全部内容

相关教程
猜你喜欢
用户评论