Ubuntu20.04安装Carla全过程(记录)
# 更新软件包列表
sudo apt update
# 安装依赖
sudo apt install -y \
libxft2 \
libssl-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libx11-dev \
libxext-dev \
libglu1-mesa-dev \
cmake \
git \
python3-pip \
python3-setuptools \
build-essential \
wget \
curl \
adb
# 安装Unreal Engine
cd ~
wget -O "UnrealEngine.tar.gz" "https://udacity-selfdrivingcar.s3.us-west-1.amazonaws.com/unrealengine/UE_4.22.3-4.23.0+release+win64.tar.gz"
mkdir -p ~/UnrealEngine423 && tar -zxvf UnrealEngine.tar.gz -C ~/UnrealEngine423
rm UnrealEngine.tar.gz
# 设置环境变量
echo 'export UE4_ROOT=~/UnrealEngine423' >> ~/.bashrc
source ~/.bashrc
# 安装Carla
cd ~
git clone https://github.com/carla-simulator/carla.git
cd carla
git submodule update --init --recursive
# 编译Carla
make Launcher.Target.Linux -j$(nproc)
# 创建Carla服务器和客户端快捷方式
echo "[Desktop Entry]
Name=CarlaUE4_Linux
Exec=$(pwd)/CarlaUE4.sh -world-port=2000 -nosound
Icon=$(pwd)/CarlaUE4.ico
Type=Application
Categories=Development;" > ~/.local/share/applications/CarlaUE4_Linux.desktop
# 设置权限
chmod +x ~/.local/share/applications/CarlaUE4_Linux.desktop
# 安装Python依赖
pip3 install --user -r ~/carla/PythonClient/requirements.txt
# 创建Python客户端快捷方式
echo "from carla import command_line
command_line.main()" > ~/CarlaClient.py
# 运行Carla
~/carla/CarlaUE4.sh -world-port=2000 -windowed -ResX=800 -ResY=600
这段代码提供了在Ubuntu 20.04上安装Carla的详细步骤。首先,它更新了软件包列表,然后安装了Carla运行所需的所有依赖。接下来,它下载并解压了Unreal Engine,设置了必要的环境变量。之后,代码克隆了Carla的仓库,初始化并更新了子模块,并编译了Carla。最后,它创建了桌面快捷方式,并安装了Python客户端所需的依赖,并提供了一个运行Carla的快捷方式。
评论已关闭