File tree 1 file changed +74
-0
lines changed
1 file changed +74
-0
lines changed Original file line number Diff line number Diff line change
1
+ 参考:
2
+
3
+ - https://my.oschina.net/leopardsaga/blog/174021
4
+ - http://blog.csdn.net/bin381/article/details/52822849
5
+
6
+ ---
7
+
8
+ 1、项目目录下创建 ` setup.py ` 文件, 目录与内容如下举例
9
+
10
+
11
+ ``` python
12
+ ~ / vomm$ tree
13
+ .
14
+ ├── LICENSE
15
+ ├── MANIFEST
16
+ ├── MANIFEST .in
17
+ ├── README .md
18
+ ├── setup.py
19
+ ├── vomm
20
+ │ ├── classes.py
21
+ │ ├── __init__ .py
22
+ │ └── tests
23
+ │ ├── __init__ .py
24
+ │ └── test_vomm.py
25
+
26
+
27
+ vim setup.py
28
+ """
29
+ 两种方式引入setup.
30
+ 一种从setuptools包,一种从distutils.core包,前者可以方便上传至PyPI发布.
31
+
32
+ 从setuptools包引入setup,要同时引入find_packages包用来搜索项目内的各packages
33
+ """
34
+ from setuptools import setup, find_packages
35
+
36
+ setup(
37
+ name = ' vomm' ,
38
+ version = 0.1 ,
39
+ packages = find_packages(),
40
+ author = ' Honghe Wu' ,
41
+ author_email = ' leopardsaga@gmail.com' ,
42
+ url = ' ' ,
43
+ license = ' http://www.apache.org/licenses/LICENSE-2.0.html' ,
44
+ description = ' Variable Order Markov Model'
45
+ )
46
+ ```
47
+
48
+
49
+ 2、添加 ` MANIFEST.in ` , 内容至少包含README说明文件
50
+
51
+ ```
52
+ $cat MANIFEST.in
53
+ include README.md
54
+ ```
55
+
56
+ 3、setup.py编译命令
57
+
58
+ ``` python
59
+ python setup.py bdist_egg # 生成类似 bee-0.0.1-py2.7.egg,支持 easy_install
60
+ python setup.py sdist # 生成类似 bee-0.0.1.tar.gz,支持 pip
61
+ python setup.py build # 编译
62
+ python setup.py bdist_wininst # Windows exe
63
+ python setup.py bdist_rpm # rpm
64
+ ```
65
+
66
+ 4、Python gz压缩包制作
67
+
68
+ 前2步同上
69
+ 最后一步为 ` python setup.py sdist ` , 生成 tar.gz 文件
70
+ tar.gz 在Linux与Windows都可方便pip安装 ` pip install <package>.tar.gz ` ,也方便发布上PyPI
71
+ 上传到 PyPI
72
+
73
+ 暂时不弄,参考 怎样制作一个 [ Python Egg] ( http://liluo.org/blog/2012/08/how-to-create-python-egg/ )
74
+
You can’t perform that action at this time.
0 commit comments