一直卡在这个问题:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages (19.0.3)

解决办法:

cd /usr/local/lib/python2.7/dist-packages
sudo rm -rf pip-19.0.3.dist-info
sudo python -m pip install --upgrade pip

解决'python -m pip install --upgrade pip'

继续安装ros2。
安装python3 -m pip install -U 的时候会遇到:

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '__init__.py'
Consider using the `--user` option or check the permissions.

解决'python -m pip install --upgrade pip'

解决办法,前面加个sudo。

解决'python -m pip install --upgrade pip'

相关文章: