系统版本
~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
安装参考:
http://wiki.ros.org/melodic/Installation/Ubuntu
根据官网的步骤,修改一下。
Installation
-
Configure your Ubuntu repositories
Configure your Ubuntu repositories to allow "restricted," "universe," and "multiverse." You can follow the Ubuntu guide for instructions on doing this.
1. Setup your sources.list
Setup your computer to accept software from packages.ros.org.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
2. Set up your keys
替换官网的方法
wget http://packages.ros.org/ros.key
sudo apt-key add ros.key
3. Installation
-
sudo apt update
There are many different libraries and tools in ROS. We provided four default configurations to get you started. You can also install ROS packages individually.
In case of problems with the next step, you can use following repositories instead of the ones mentioned above ros-shadow-fixed
Desktop-Full Install: (Recommended) : ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators and 2D/3D perception
-
sudo apt install ros-melodic-desktop-full
-
source ~/.bashrc
-
roscore
运行roscore 没问题,即安装完成。
-
踩坑一: python 版本
报错,猜测是python 版本问题
Errors were encountered while processing:
python3-lib2to3.
发现默认版本是3.7.5
踩坑二:
sudo rosdep init ERROR: cannot download default sources list from:
解决办法: 本文之后,世上再无rosdep更新失败问题!如果有....小鱼就...
用上述内容里的指令代替官网指令。
用 pip install又出错,见下文,设置PIP_NO_CACHE_DIR
。
设置密钥语句:curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
出现错误:gpg:no valid OpenPGP data found
解决方法:不用官网那个,用下面这个
wget http://packages.ros.org/ros.key
sudo apt-key add ros.key
遇到pip install 安装什么都报错 AttributeError: ‘int‘ object has no attribute ‘endswith‘
1、错误的解决方式,在使用pip2
安装命令之前设置:PIP_NO_CACHE_DIR=off
,例如我在python2的环境中安装pyquaternion,安装命令就修改为:
PIP_NO_CACHE_DIR=off pip2 install pyquaternion
设置为off
,其作用就是安装的时候不禁用pip缓存目录
2、当然你也可以把:PIP_NO_CACHE_DIR=off
的值设置为:0 或 no 或 off 或 false
3、在配置文件中设置,就不用每次安装都在开头都加上这句话了
如果是在python3中可以在配置文件(linux环境):
vim ~/.pip/pip.conf