从源码运行 mower-ng

本文介绍如何从源码运行 mower-ng。

Python 3.12

从 Python 官网下载 3.12.7 版本并安装:

https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe

Ubuntu 24.04 自带 Python 3.12.3,直接安装即可:

1
sudo apt install python3-venv python3-tk python3-dev

对于其它版本的 Ubuntu,可通过 deadsnakes ppa 安装:

1
2
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.12 python3.12-venv python3.12-tk python3.12-dev

使用 Homebrew 安装 Python 3.12:

1
brew install python@3.12 python-tk@3.12

其它依赖

1
sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config gir1.2-webkit2-4.1 gir1.2-appindicator3-0.1 libzbar0 adb git
1
brew install zbar

下载代码

1
2
3
git lfs install
git clone https://git.zhaozuohong.vip/mower-ng/mower-ng.git --branch fast
cd mower-ng

Python 依赖

建立并激活虚拟环境,安装依赖。

如果在安装 Python 时未将其加入 PATH,则需手动指定完整路径。默认安装路径为 %LocalAppData%\Programs\Python\Python312

1
2
3
%LocalAppData%\Programs\Python\Python312\python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
1
2
3
4
python3.12 -m venv venv
source venv/bin/activate
pip install -r requirements.in
pip install pycairo PyGObject
1
2
3
$(brew --prefix)/opt/python@3.12/libexec/bin/python -m venv venv
source venv/bin/activate
pip install -r requirements.in

运行

1
python webview_ui.py
1
./webview_ui.py
1
./webview_ui.py