公司的渣渣网速,在服务器上pip install h3的时候老是git clone 失败,不得已,只能手动安装h3的包,下面就是我安装h3包的全部过程。
检查cmake版本
如果版本显示是3.1以上就算OK的,但是在centos下面使用yum安装的默认就是2.8的版本,所以需要自己手动安装一下,如何安装我就不说了,传送门给你们:Centos7安装高版本Cmake
下载文件
自己下载对于的master压缩包
-
https://github.com/uber/h3
-
https://github.com/uber/h3-py
解压文件
1
2
3
4
5
|
unzip h3-master.zip
unzip h3-py-master.zip
|
修改.install.sh文件
在解压后的h3-py-master文件夹中有一个.install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#!/usr/bin/env bash
set -ex
VERSION=$1
IS_64BITS=$2
if [ "" == "$VERSION" ]; then
echo "Failed to specify version required"
exit 1
fi
command -v cmake >/dev/null 2>&1 || { echo "cmake required but not found."; exit 1; }
mkdir -p h3/out
rm -rf h3c
git clone https://github.com/uber/h3.git h3c
pushd h3c
git pull origin master --tags
git checkout "$VERSION"
if [ "Windows_NT" != "$OS" ]; then
command -v make >/dev/null 2>&1 || { echo "make required but not found."; exit 1; }
command -v cc >/dev/null 2>&1 || { echo "cc required but not found."; exit 1; }
cmake -DENABLE_FORMAT=OFF -DBUILD_SHARED_LIBS=ON .
make
ls -l lib/libh3*
cp lib/libh3* ../h3/out
if [ -e ../build ] && [ -d ../build ]; then
LIBNAME=`ls ../build/ | grep '^lib'`
mkdir -p ../build/$LIBNAME/h3/out
cp lib/libh3* ../build/$LIBNAME/h3/out
fi
else
# Assumed to be Windows, default to x86
if [[ "True" == "$IS_64BITS" ]]; then
# to build on win 10 with VS 16 use this command:
cmake . -DENABLE_FORMAT=OFF -DBUILD_SHARED_LIBS=ON -A x64
else
cmake . -DENABLE_FORMAT=OFF -DBUILD_SHARED_LIBS=ON
fi
cmake --build . --target h3 --config Release
ls -l bin/Release/*
cp bin/Release/h3.dll ../h3/out
fi
popd
rm -rf h3c
|
将17, 20, 21注释掉即可,这些都是下载并更新仓库h3的代码
移动文件
将解压后的文件夹h3-master
移动到h3-py-master
中,并且更名为h3c
编译并安装
在h3-py-master
文件夹中执行
1
2
3
4
5
|
python setup.py build
python setup.py install
|
好了,以上就是整个安装流程,祝大家coding愉快!