简体   繁体   中英

ModuleNotFoundError: No module named 'rosbag' with pip

I am trying to install rosbag using pip:

pip install python-rosbag

But I am getting the following error:

(base) C:\Users\santhoshe.e\annotator-master>pip install python-rosbag Collecting python-rosbag ERROR: Could not find a version that satisfies the requirement python-rosbag (from versions: none) ERROR: No matching distribution found for python-rosbag

How can I install rosbag in windows other than using pip ? Or the pip I used is wrong?

pyrosbag is actually a different package from rosbag .

The right way should be

conda install -c conda-forge ros-rosbag 

After that, you can run import rosbag in Python.

我觉得应该是这样的:

pip install pyrosbag

Try this to install pyrosbag using pip:

pip install pyrosbag

Now in the docs, the Usage page shows the import command as:

import pyrosbag

I would suggest to install ros noetic (I installed the desktop-full version). See link: http://wiki.ros.org/noetic/Installation/Ubuntu

If you then source the setup script for ros via the following command: source /opt/ros/noetic/setup.bash

Python should be able to import rosbag.

Actually for rosbag, it is not very easy to install by using pip.

However you can use installation steps defined in ROS wiki.

But it is not done after installing rosbag, you should also add PYTHONPATH for the rosbag in your interpreter. Which can be done by simply selecting File>Settings>Project Interpreter and click the gear right next to your interpreter.

After that you will see two options : Add/ShowAll. Go with Show All and on the window that opened, on the right hand side, you will see +,-,..., a symbol that shows the paths for the selected interpreter (the symbol listed at the end)

Under these paths you should also define the path that you installed ros. For me, the path is :

/opt/ros/melodic/lib/python2.7/dist-packages

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM