目录结构:

F:\capt>tree
├─abc_test
│  ├─__init__.py
│  ├─comman_line.py
├─setup.py
#__init.py__
def hello():
print 'hi mi!'
return 'Hello World!'
#setup.py
from setuptools import setup setup(name='abc_test',
version='0.1',
description='The funniest joke in the world',
url='http://github.com/storborg/funniest',
author='Flying Circus',
author_email='flyingcircus@example.com',
license='MIT',
packages=['abc_test'],
install_requires=['requests', 'xxhash'],
entry_points={
'console_scripts': ['funniest-joke=abc_test.command_line:main'], },
zip_safe=False)
#command_line.py
def main():
print "this is command line"

安装到本地,测试库时要打开新的dos窗口

二、依赖

install_requires=['requests', 'xxhash'],   此行是添加依赖,python setup.py install时会安装这些依赖。

三、Command Line Scripts

entry_points={

        'console_scripts': ['funniest-joke=abc_test.command_line:main'],
 
python setup.py install 自动生成以下脚本到Python27/Scripts目录下:

dos窗口执行:

参考:

How To Package Your Python Code — Python Packaging Tutorial
https://python-packaging.readthedocs.io/en/latest/index.html

Python使用setuptools打包源文件(精简)的更多相关文章

  1. Python中setuptools做什么用的?

    概括 setuptools是 Python Enterprise Application Kit(PEAK)的一个副项目,它 是一组Python的 distutilsde工具的增强工具(适用于 Pyt ...

  2. ez_setup.py(安装python下setuptools用)

    #!python"""Bootstrap setuptools installation If you want to use setuptools in your pa ...

  3. python开发环境配置和python源码打包生成exe可执行文件

    Windows下开发环境准备 1.分别安装:python2和python32.安装Python的集成工具:Anaconda3.安装Pycharm Pycharm设置 设置: File->Sett ...

  4. python模块的打包

    python模块的打包方法: http://blog.csdn.net/five3/article/details/7847551

  5. Python Windows下打包成exe文件

    Python Windows 下打包成exe文件,使用PyInstaller 软件环境: 1.OS:Win10 64 位 2.Python 3.7 3.安装PyInstaller 先检查是否已安装Py ...

  6. Python安装setuptools时报Compression requires the (missing) zlib

    装机员为您提供Python安装setuptools时报Compression requires the (missing) zlib的文章咨询供您阅读,如何使用Python安装setuptools时报 ...

  7. Python服务Debian打包新思路

    此文已由作者张耕源授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. Debian 打包一直是比较冷僻的技术,大部分同学都不会接触到它. 但是我们 Debian 服务器上安装的各 ...

  8. Python selenium chrome打包exe后禁用控制台输出滚动日志

    Python selenium chrome打包exe后,在运行的过程中,如果遇到需要input()输入时,会发现被不断滚动刷新的日志把命令行输入快速顶掉了,通过查阅资料不断实践,发现以下方法有效: ...

  9. 转载 Python 安装setuptools和pip工具操作方法(必看)

    本文章转载自 脚本之家 http://www.jb51.net  感谢! setuptools模块和pip模块是python进行第三方库扩展的极重要工具,例如我们在需要安装一些爬虫或者数据分析的包时就 ...

随机推荐

  1. Purpose of XMLString::transcode

    原文地址http://stackoverflow.com/questions/9826518/purpose-of-xmlstringtranscode I don't seem to underst ...

  2. 「NOI2014」动物园

    link : https://loj.ac/problem/2246 水水KMP #include<bits/stdc++.h> #define ll long long #define ...

  3. JD路径配置及myeclipse主题和提示设置

    1. JDKAN安装及环境变量配置 安装jdk,注意记住安装路径(F:\Java\jdk1.8.0_121 )(个人爱好) 系统变量→新建 JAVA_HOME 变量 . 变量值填写jdk的安装目录(F ...

  4. Ext.Ajax.request批量提交表单

    介绍一下批量提交grid中数据的问题 js文件中的提交方法如下: listeners: { click: function btnClick(button) { var win = button.up ...

  5. 【IntelliJ IDEA】idea导入项目只显示项目中的文件,不显示项目结构

    导入项目之后,只显示项目文件,不显示项目结构 解决方法 1.点击file->project structure..->Modules 点击右上角+加号 ->import Module ...

  6. 深度排序与alpha混合 【转】

      翻译:李现民 最后修改:2012-07-03 原文:Depth sorting alpha blended objects 先说个题外话,本来我想回答在 Creators Club论坛上的一个常见 ...

  7. 转: 基于netty+ protobuf +spring + hibernate + jgroups开发的游戏服务端

    from: http://ybak.iteye.com/blog/1853335 基于netty+ protobuf +spring + hibernate + jgroups开发的游戏服务端 游戏服 ...

  8. 5.4 heapq--堆队列算法

    本模块实现了堆队列算法,也叫作优先级队列算法.堆队列是一棵二叉树.而且拥有这样特点,它的父节点的值小于等于不论什么它的子节点的值,假设採用数组array实现,能够把它们的关系表示为:heap[k] & ...

  9. C++编译错误 2001 1120

    无法解析的外部符号"symbol" 代码引用了链接器无法在库和对象文件中找到的内容(如函数.变量或标签). 该错误信息之后为错误 LNK1120. 可能的原因 : 在将托管库或 W ...

  10. 使用Python与数据库交互

    # -*- coding: utf-8 -*- """ Created on Sun Nov 18 19:25:01 2018 @author: wangm " ...