解決辦法:
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 中指定的目錄來查找導入的模塊。