在pycharm中搭建rospy环境

在终端输入

sudo gedit ~/.local/share/applications/jetbrains-pycharm-ce.desktop

会出现

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Welcome to PyCharm
Icon=jetbrains-pycharm-ce.png
Path=/home/hao/pycharm-community-2018.3.4/bin
Exec=/home/hao/pycharm-community-2018.3.4/jre64/bin/java -classpath /home/hao/pycharm-community-2018.3.4/lib/bootstrap.jar:/home/hao/pycharm-community-2018.3.4/lib/extensions.jar:/home/hao/pycharm-community-2018.3.4/lib/util.jar:/home/hao/pycharm-community-2018.3.4/lib/jdom.jar:/home/hao/pycharm-community-2018.3.4/lib/log4j.jar:/home/hao/pycharm-community-2018.3.4/lib/trove4j.jar:/home/hao/pycharm-community-2018.3.4/lib/jna.jar -Xms128m -Xmx750m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djdk.http.auth.tunneling.disabledSchemes="" -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Dawt.useSystemAAFontSettings=lcd -Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine -XX:ErrorFile=/home/hao/java_error_in_PYCHARM_%p.log -XX:HeapDumpPath=/home/hao/java_error_in_PYCHARM.hprof -Didea.paths.selector=PyCharmCE2018.3 -Djb.vmOptionsFile=/home/hao/pycharm-community-2018.3.4/bin/pycharm64.vmoptions -Didea.platform.prefix=PyCharmCore com.intellij.idea.Main
StartupNotify=false
StartupWMClass=jetbrains-pycharm-ce
OnlyShowIn=Unity;
X-UnityGenerated=true

此时需要修改 Exec= 后的内容,添加 bash -i -c ,修改后的内容为

Exec= bash -i -c "/home/hao/pycharm-community-2018.3.4/jre64/bin/java -classpath /home/hao/pycharm-community-2018.3.4/lib/bootstrap.jar:/home/hao/pycharm-community-2018.3.4/lib/extensions.jar:/home/hao/pycharm-community-2018.3.4/lib/util.jar:/home/hao/pycharm-community-2018.3.4/lib/jdom.jar:/home/hao/pycharm-community-2018.3.4/lib/log4j.jar:/home/hao/pycharm-community-2018.3.4/lib/trove4j.jar:/home/hao/pycharm-community-2018.3.4/lib/jna.jar -Xms128m -Xmx750m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djdk.http.auth.tunneling.disabledSchemes="" -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Dawt.useSystemAAFontSettings=lcd -Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine -XX:ErrorFile=/home/hao/java_error_in_PYCHARM_%p.log -XX:HeapDumpPath=/home/hao/java_error_in_PYCHARM.hprof -Didea.paths.selector=PyCharmCE2018.3 -Djb.vmOptionsFile=/home/hao/pycharm-community-2018.3.4/bin/pycharm64.vmoptions -Didea.platform.prefix=PyCharmCore com.intellij.idea.Main" %f

添加 bash -i -c 是为了在通过快捷方式启动PyCharm的同时加载ROS环境变量(ROS环境变量加载脚本配置在 ~/.bashrc 文件内)

你可能感兴趣的:(ROS点滴)