您的位置:首页 > 编程语言 > Python开发

使用Python开发程序

2013-04-26 00:00 246 查看
1. 可以安装eclipse for python,作为开发IDE

2. 安装easy_install,来安装egg组件。Egg类似java的jar,当第三方egg被安装,它会被安装到%Home%\Lib\site-packages

3. 安装git与gitbash

4. 新建python项目之后,将setup.py放入项目中,方便之后进行打包处理。

5. Setup.py的源码如下:


1
#
-*-coding: UTF-8-*-

2

3

from
distutils.core
import
setup
4

5

import
py2exe
6

7

#
Powered by ***

8

9
INCLUDES
=
[]
10

11
options
=
{
"
py2exe
"
:
12

13
{
"
compressed
"
:
1
,
14

15

"
optimize
"
:
2
,
16

17

"
bundle_files
"
:
2
,
18

19

"
includes
"
: INCLUDES,
20

21

"
dll_excludes
"
: [
"
MSVCP90.dll
"
,
"
mswsock.dll
"
,
"
powrprof.dll
"
,
"
w9xpopen.exe
"
] }}
22

23
setup(
24

25
options
=
options,
26

27
description
=

"
招XXXX文件程序
"
,
28

29
zipfile
=
None,
30

31
console
=
[{
"
script
"
:
"
Main.py
"
,
"
icon_resources
"
: [(
1
,
"
logo.ico
"
)] }],
32

33
)
34

35


6. 安装EGIT

Help->install new Software

Add

http://download.eclipse.org/egit/updates





并等待安装的完成。

7. 初次配置git

git config --global user.name have4fun

git config --global user.email have2cow@gmail.com

将user.name 与 user.email 替换为,自己的用户名与可用邮箱。

8. 将项目纳入git管理

在项目的根目录下输入

git init

git add *

git commit -m "Initial commit"

9. 通过EGIT将项目纳入git管理

项目->右键->team->share project->git





如下图所示,选择工程,然后选择Use or create…,进入选择Create Repository对这个工程初始化一个git版本库,如果这个工程已经在于一个版本库的工作树上的话,这个版本库会自动选









对工程点击右键,选择team,会出来git的命令,选择commit,然后选择你要提交的文件,加上提交留言,点击commit,完成提交





10. 将项目push到远程版本库(gitlab)

登陆gitlab(gitlabhost)

创建New project

创建后得到如下页面:





按照如上提示将本地项目push到远程仓库,具体步骤如下:

git remote add gitlab git@gitlabhost:qianlei/checkfileforcmbcfinancial.git

git push -u gitlab master





表示已经推送到远程仓库成功

11. 通过egit将项目push到远程仓库。

右键项目->team->remote->push





点击下一部,并选择要push的分支





点击完成。

12. 从git仓库clone项目并打包

git clone git@gitlabhost:qianlei/checkfileforcmbcfinancial.git

python setup.py py2exe -p lxml,gzip,suds

(-p 参数,指明了第三方类库,会根据项目的不同,如果遇到ImportError: No module named XXX)

可以在%Home%\Lib\site-packages目录下,将相应的.egg提取出来(用rar,7z)放到site-packages即可)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: