构建一个发布文件,在isOdd文件夹下打开一个终端,执行命令:python3 setup.py sdist $ python3 setup.py sdist running sdist running check warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list) warning : sdist: standard file not found: should have one of README, README.txt, README.rst writing manifest certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)> 执行 python3 setup.py sdist upload 方法2: 使用twine上传你的项目 pip3 install twine python3 setup.py sdist python3 setup.py sdist twine upload
第一步,打包成可分发的文件: $ python setup.py sdist bdist_wheel --universal 这条命令会同时生成源代码包(Source Distribution),和二进制包 上传 可能有老的教程,让你直接用python setup.py sdist bdist_wheel register upload打包上传一步到位,这个方式已经过时了不推荐使用。 backend 需要实现几个约定的接口: get_requires_for_build_wheel,构建 wheel 需要的依赖列表,这个一般没有特殊要求都是空 get_requires_for_build_sdist ,构建 sdist 需要的依赖列表,同上 prepare_metadata_for_build_wheel,生成一个 wheel 要用的dist-info/文件夹 build_wheel,生成 wheel 文件 build_sdist,生成 sdist 文件 有了这些接口,pip以及其他可能的 frontend 就能从源代码构建一个 wheel 出来。
打包命令 打包命令其实有两个,一个是 sdist,另一个是 bdist_wheel,后者需要安装 wheel 才能执行不然会报错。 也就是说,如果你在上传到 PyPI 之前就执行 python setup.py sdist bdist_wheel 打包,那么会同时得到一个 tar.gz 和一个 whl 的包,这个时候使用 pip install 1、打包应该用 sdist 还是 bdist_wheel ? 我的回答是一起用,将两个文件一起上传到 PyPI,同时,在本地执行上传命令前应该先查看一下两个包里面的内容是否缺少。 它的作用是对 bdist_wheel 打包命令生效的,前面说到了 MANIFEST.in 文件可以来定义一些非 Python 包的文件被打包,但是定义的只有 sdist 打出来的源文件包才有效,这个时候其实对 所以当你想让 sdist 和 bdist_wheel 打出来的包有差异的时候,可以通过这个参数来单独定义 bdist_wheel 打出来的包的内容。
第一步,打包成可分发的文件: $ python setup.py sdist bdist_wheel --universal 这条命令会同时生成源代码包(Source Distribution),和二进制包 这个文件名不是乱来的,是要遵循一定规则,下载器能直接从这个文件名获得这个包的基本信息: 上传 可能有老的教程,让你直接用python setup.py sdist bdist_wheel register backend 需要实现几个约定的接口: get_requires_for_build_wheel,构建 wheel 需要的依赖列表,这个一般没有特殊要求都是空 get_requires_for_build_sdist ,构建 sdist 需要的依赖列表,同上 prepare_metadata_for_build_wheel,生成一个 wheel 要用的dist-info/文件夹 build_wheel,生成 wheel 文件 build_sdist,生成 sdist 文件 有了这些接口,pip以及其他可能的 frontend 就能从源代码构建一个 wheel 出来。
折腾了老半天,得到以下结论: 构建一个发布文件: linux:python3 setup.py sdist windows:py setup.py sdist (要首先打开文件所在地;链接复制过来
sub_B/ __init__.py b.py 4.生成发布压缩包 同目录下执行python setup.py sdist C:\Users\Se7eN_HOU\Desktop\myModule>python setup.py sdist running sdist running check warning: check warning: check: missing meta-data: if 'author' supplied, 'author_email' must be supplied too warning: sdist : manifest template 'MANIFEST.in' does not exist (using default file list) warning: sdist: standard
index-servers = local [local] repository: http://localhost:2233 username: admin password: 123456 然后使用sdist 命令创建源分发,使用twine上传 release:clean_pyc python setup.py sdist bdist_wheel twine upload -r local .
、setup.py编译命令 python setup.py bdist_egg # 生成类似 bee-0.0.1-py2.7.egg,支持 easy_install python setup.py sdist bdist_wininst # Windows exe python setup.py bdist_rpm # rpm 4、Python gz压缩包制作 前2步同上 最后一步为 python setup.py sdist
pip检索的tar.gz tarball是一个源分发包,或sdist,而不是一个轮子。在某些方面,sdist是轮子的反义词。 源代码发行版包含源代码。 从开发人员的角度来看,当您运行以下命令时,会创建一个源分发包: $ python setup.py sdist 现在尝试安装一个不同的包:chardet: $ python -m pip install 到目前为止,您已经看到了轮子和sdist之间的一些明显区别,但更重要的是这些区别对安装过程的影响。 轮子加速安装 在上面,您看到了获取预构建轮子的安装和下载sdist的安装的比较。
install_scripts install scripts (Python or otherwise) install_data install data files sdist 命令详解: 1.sdist:用来创建一个源码包,在windows下为zip格式,linux下为tag.gz格式 。 setup.py示例: from setuptools import setup setup(name='xxx',version='0.1.1') 打包命令:python setup.py sdist
CSIDL_LOCAL_APPDATA>\pip\Cache python包生成过程: 1、新建目录,并在目录下创建setup.py文件 2、然后创建功能模块,本项目是cutImages包 3、打包 python setup.py sdist bdist_wheel bdist_egg # sdist: 生成类似 *.tar.gz,支持 pip # bdist_egg: 生成类似 *.egg,支持 easy_install 4、注册(如果没有
setup.py文件的使用: % python setup.py build #编译 % python setup.py install #安装 % python setup.py sdist find_packages setup(name='foo', version='1.0', py_modules=['foo'], ) (2).然后,运行python setup.py sdist any', tests_require=['nose'], test_suite='nose.collector', ) (2).然后,运行python setup.py sdist
典型地,setuptools 包中就支持多级/链式子命令:setup.py sdist bdist_wheel upload。 实现链式命令组变得非常简单,只需在 click.group 中指定 chain=True: @click.group(chain=True) def cli(): pass @cli.command('sdist ') def sdist(): click.echo('sdist called') @cli.command('bdist_wheel') def bdist_wheel(): click.echo ('bdist_wheel called') 调用命令则有: $ setup.py sdist bdist_wheel sdist called bdist_wheel called 2.7 命令组
】 接着在cmd里输入: 你的python.exe的位置,我的是放在D:\Python27\python.exe 所以输入的是 D:\Python27\python.exe setup.py sdist 回车之后会出现running sdist……不用管了,窗口不要关,下面还要用。
torch>=1.4"], packages=find_packages(), include_package_data=True, ) 我们运行如下命令 python setup.py sdist 现在我们重新执行打包命令 python setup.py sdist bdist_wheel 这个时候所有yaml文件也成功打包好了 myapp/ ├── build │ ├── bdist.linux-x86
='demo', version='0.0.1', packages=['demo'] ) 在项目根目录下执行以下命令来生成Python代码分发包: python setup.py sdist 比如在本地项目中, 执行以下命令: python setup.py sdist upload -r http://localhost:8080 此时, upload 命令仍然会提示输入密码, 此时直接回车确认就可以了 localhost 或者地址为 http://localhost:8080 的PyPI源上传Python包时, 用户名 sam 和密码 123456 就会被用来验证操作权限: python setup.py sdist
name='demo', version='0.0.1', packages=['demo'] ) 在项目根目录下执行以下命令来生成Python代码分发包: python setup.py sdist 比如在本地项目中, 执行以下命令: python setup.py sdist upload -r http://localhost:8080 此时, upload 命令仍然会提示输入密码, 此时直接回车确认就可以了 localhost 或者地址为 http://localhost:8080 的PyPI源上传Python包时, 用户名 sam 和密码 123456 就会被用来验证操作权限: python setup.py sdist
最后一步就是生成「发布压缩包」: python3 setup.py sdist 同样回车以后会产生一些提示信息: running sdist running check warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list) warning: sdist: standard file
详细教程参考:https://blog.csdn.net/lezardfu/article/details/44891559 提交命令: python3 setup.py sdist upload 最后服务器响应
.py ├── setup.py ├── tests │ └── __init__.py │ └── __pycache__/ └── docs 使用打包命令 python setup.py sdist global-exclude __pycache__ global-exclude *.log global-exclude *.pyc 根据以上文件内容,在使用命令 python setup.py sdist rm dist/* # 生成代码存档 .tar.gz 文件和构建文件 .whl 文件 python setup.py sdist bdist_wheel # 如果发布到TestPyPI使用以下命令 twine