欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Loongnix安装PyCharm Community 2020.2.3的教程详解

程序员文章站 2022-04-12 19:27:52
安装java运行环境loongnix官方仓库里面的openjdk是1.8.0_212版本, 已经测试通过$ sudo yum install -y java-latest-openjdk$ java...

安装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面板遇到了错误:

Loongnix安装PyCharm Community 2020.2.3的教程详解

查看了下~/.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架构,看来还得动手解决了,参考*上的这个问题进行解决:

主要过程就是从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面板就正常了

Loongnix安装PyCharm Community 2020.2.3的教程详解

解决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, 欧耶!没有提示了!

到此这篇关于loongnix安装pycharm community 2020.2.3的教程详解的文章就介绍到这了,更多相关loongnix安装pycharm community内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!