Carla-ModuleNotFoundError: No module named ‘agents.navigation‘
解决办法:
You need to make sure that _agents _ is in your (PYTHON)PATH variable or your working dictionary.
Setting your working dictionary to <CARLA_ROOT>/PythonAPI/carla would fix it as agents is a sub dictionary. Similarly adding the carla folder to your PYTHONPATH (quick and dirty way via sys.path.append(“<CARLA_ROOT>/PythonAPI/carla”) at the top of your file.
因此,通常在你的.bashrc环境文件中添加如下语句即可(下方的xxx为你的系统名):
export CARLA_ROOT=/home/xxx/carla/CARLA_0.9.13
export PYTHONPATH=$PYTHONPATH:$CARLA_ROOT/PythonAPI/carla
补充知识:
1.CARLA_ROOT 是 CARLA 仿真环境的根目录环境变量。这个变量通常用于指向你安装 CARLA 仿真环境的主目录(即包含 PythonAPI 和其他资源的目录)。
2.PYTHONPATH 是一个 Python 环境变量,用于告诉 Python 解释器在哪里查找模块和包。它的作用类似于文件系统中的目录路径,Python 通过 PYTHONPATH 中指定的目录来查找导入的模块。