我一直在尝试使用 Carla 自动驾驶汽车环境,但是当我尝试运行本教程中的代码时遇到“AttributeError:模块‘carla’没有属性‘客户端’”:https://pythonprogramming。 net/control-camera-sensor-self-driving-autonomous-cars-carla-python/。我对代码进行了一些更改,包括将 .egg 文件更改为我计算机中的确切文件路径。
这是我的代码...
'''
import glob
import os
import sys
try:
sys.path.append(glob.glob('C:\Downloads\CARLA_0.9.9.4\WindowsNoEditor\PythonAPI\carla\dist\carla-0.9.9-py3.7-win-amd64.egg'))
except IndexError:
pass
import carla
actor_list = []
#try:
client = carla.Client("localhost", 2000)
client.set_timeout(2.0)
world = client.get_world()
blueprint_library = world.get_blueprint_library()
#finally:
for actor in actor_list:
actor.destroy()
print("All cleaned up!")
''' 只是为了参考,我在具有 anaconda3 和 python 3.7.7 的 Windows 10 上运行,并且我使用的是 carla 版本 0.9.9.4。提前致谢!