首先创新虚拟环境
conda cerate -n cityflow python=3.8
conda activate cityflow
在安装任何新软件之前,更新系统的本地软件包列表是一个至关重要的步骤。这个操作会从 Ubuntu 的软件源同步最新的软件包信息,确保系统能够找到并安装正确版本的依赖项。
执行以下命令来更新软件包列表:
sudo apt update
安装核心编译工具:
sudo apt install -y build-essential cmake
安装python3和pip编译器
python3 --version
sudo apt install -y python3-pip
pip3 --version
安装Git版本控制系统
sudo apt install -y git
git --version
获取CityFlow源码:
git clone https://github.com/cityflow-project/CityFlow.git
cd CityFlow
pip3 install .
验证:
python3
import cityflow
print("Successfully imported 'cityflow' module.")
# Access the Engine component as described in the documentation [2]
# This tests if the Engine attribute/class is available
engine_component = cityflow.Engine
print(f"Successfully accessed 'cityflow.Engine'. Type: {type(engine_component)}")
# To exit the Python interpreter
exit()