编译leveldb
git clone https://github.com/google/leveldb.git
cd leveldb
# 这里我用的是1.23版本
git checkout 1.23
git submodule init
git submodule update
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A x64
cmake --build . --config Release
编译plyvel
git clone https://github.com/wbolster/plyvel.git
cd plyvel
git checkout 1.5.1
# 可能需要将cython路径添加到PATH变量
pip install cython
# 生成plyvel/_plyvel.cpp
cython -+ plyvel/_plyvel.pyx
# 修改setup.py
# 需要自行修改leveldb路径
ext_modules = [
Extension(
'plyvel._plyvel',
sources=['plyvel/_plyvel.cpp', 'plyvel/comparator.cpp'],
libraries=['leveldb'],
extra_compile_args=[f'-IC:\\path\\to\\leveldb\\include'],
extra_link_args=['-LIBPATH:C:\\path\\to\\leveldb\\build\\Release']
)
]
python setup.py build_ext --inplace
# 可能需要管理员权限
python setup.py install
收工,祝你好运!
标签:cython,git,windows,cd,plyvel,leveldb,build,安装 From: https://www.cnblogs.com/legstrong/p/18395548