其实Ubuntu下安装pygame不难,但万一错了就很麻烦。
当时先搜到这个安装命令:sudo apt-get install python-pygame就执行了,安装成功,然后运行,发现报错:
Index Error: bytes to write exceed buffer size
这个错误提示很少,网上答案也少,后来在carla-issue找到相同的,说是apt安装pygame引起的,正确方式应该是用pip
所以先删除apt安装的:sudo apt-get --purge remove python-pygame
然后重新pip安装:
sudo pip install pygame或者
sudo pip3 install pygame
这个过程会比较耗时