1. 前言
关于PyMesh
PyMesh is a code base developed by Qingnan Zhou for his PhD research at New York University. It is a rapid prototyping platform focused on geometry processing. PyMesh is written with both C++ and Python, where computational intensive functionalities are realized in C++, and Python is used for creating minimalistic and easy to use interfaces.
PyMesh GitHub仓库:GitHub - PyMesh/PyMesh: Geometry Processing Library for Python
在Linux和MacOS中,PyMesh可以使用setup.py
完成一键安装,但由于依赖库及编译环境所限,在Windows中使用该脚本会导致许多错误,而无法完成编译和安装。
经过多次踩坑,我成功地在Windows中安装运行了PyMesh,在此进行记录。
系统环境
- Windows 10 20H2
- MSYS2
2. 环境配置
PyMesh安装指南中涉及到一些系统依赖,这些依赖需要单独安装:
- Python
- NumPy
- SciPy
- GMP
- MPFR
- Boost
本次编译在MSYS2环境下进行。开发软件包选择mingw-w64-x86_64-*
,因此编译产品可以直接在Windows原生环境中运行。
-
运行MSYS2 MinGW x64终端,并运行以下命令安装所需工具:
# 安装必需的dev库和工具 pacman -S base-devel msys2-devel # 安装MinGW工具链 pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja # 安装Python和依赖库 pacman -S mingw-w64-x86_64-python3 mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-scipy # 安装GMP和MPFR所需的m4依赖 pacman -S m4 # 我的环境配置如下 $ which make gcc g++ gfortran cmake ninja /mingw64/bin/make /mingw64/bin/gcc /mingw64/bin/g++ /mingw64/bin/gfortran /mingw64/bin/cmake /mingw64/bin/ninja
-
克隆PyMesh仓库。此处建议使用FastGit代理来加速完整仓库和子模块的克隆。
git clone https://github.com/PyMesh/PyMesh.git cd PyMesh git submodule update --init
-
前往
pymesh/
以外的文件夹,在Boost网站下载、解压、安装Boost。本案例使用boost_1_78_0