如何将 ros 导入 PyCharm [英] How to import ros to PyCharm

查看:44
本文介绍了如何将 ros 导入 PyCharm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ros 框架开发机器人.作为ide,我使用PyCharm.但是我不能把ros导入进去.在 ros 站点上有关于 ide http://wiki.ros.org/IDEs 的文章.有关于在 pycharm 中使用 ros 的信息.我必须修改 .desktop 文件,但我使用软件中心的 snap 安装了 PyCharm.在哪里可以找到 snap 应用程序的 .desktop 文件?能否有其他方法将ros导入PyCharm?

I am developing a robot using the ros framework. As ide, I use PyCharm. But I can’t import ros into it. On the ros site there is the article about ide http://wiki.ros.org/IDEs. There is information about using ros with pycharm. I have to modify the .desktop file, but I installed PyCharm using a snap from the software center. Where can I find the .desktop file for snap applications? Can there be another method to import ros into PyCharm?

@hug 是的,我在这里启动了这个命令,结果是

@hug Yes, I launched this command here is the result

/snap/pycharm-community/103/meta/gui/pycharm-community.desktop
/snap/pycharm-community/103/snap/gui/pycharm-community.desktop
/var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop
/var/tmp/pycharm-community.desktop.swp

我认为 .swp 文件自上次重新安装 PyCharm 以来一直存在.当我自己尝试重新安装并意识到我破坏了程序时,我重新安装了.

I think that the .swp file has remained since the last reinstallation of PyCharm. I reinstalled when I tried to do it myself and realized that I had broken the program.

推荐答案

如果你想使用来自 Pycharm IDE 中的 ROS 包的自动建议,你可以执行以下说明:

If you want to use from the auto-suggestion with ROS packages in Pycharm IDE, you could do the following instructions:

  1. 文件 > 设置(或Ctrl+Alt+s 作为快捷方式)> 项目: > 项目解释器.

  1. File > Settings (or Ctrl+Alt+s as shortcut)> Project: > Project interpreter.

在项目解释器下拉列表中,您可以通过从列表中选择适当的来指定 ROS Python 解释器.

In the project interpreter dropdown list, you can specify ROS Python interpreter by selecting the appropriate from the list.

<小时>

[注意]:

您可以使用上述说明添加虚拟环境,然后您应该使用 此说明.

You could add a virtual environment with the above instructions, then you should add ROS distpackages (roslib) on it with this instruction.

你需要的ROS distpackages路径:/opt/ros/kinetic/lib/python2.7/distpackages

ROS distpackages path that you need: /opt/ros/kinetic/lib/python2.7/distpackages

这篇关于如何将 ros 导入 PyCharm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆