Loongnix安裝PyCharm Community 2020.2.3的教程詳解
安裝java執行環境
Loongnix官方倉庫裡面的openjdk
是1.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,歐耶!沒有提示了!
到此這篇關於Loongnix安裝PyCharm Community 2020.2.3的教程詳解的文章就介紹到這了,更多相關Loongnix安裝PyCharm Community內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!