<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://zxdd.com/index.php?action=history&amp;feed=atom&amp;title=PyPI</id>
	<title>PyPI - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://zxdd.com/index.php?action=history&amp;feed=atom&amp;title=PyPI"/>
	<link rel="alternate" type="text/html" href="https://zxdd.com/index.php?title=PyPI&amp;action=history"/>
	<updated>2026-06-10T00:11:37Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://zxdd.com/index.php?title=PyPI&amp;diff=204&amp;oldid=prev</id>
		<title>Eric：​创建页面，内容为“PyPI（Python Package Index）是Python官方的第三方软件包平台，用于存储和分发python的软件包。pip默认从PyPI平台下载安装软件…”</title>
		<link rel="alternate" type="text/html" href="https://zxdd.com/index.php?title=PyPI&amp;diff=204&amp;oldid=prev"/>
		<updated>2020-09-19T16:57:08Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“PyPI（Python Package Index）是&lt;a href=&quot;/Python&quot; title=&quot;Python&quot;&gt;Python&lt;/a&gt;官方的第三方软件包平台，用于存储和分发python的软件包。&lt;a href=&quot;/Pip&quot; title=&quot;Pip&quot;&gt;pip&lt;/a&gt;默认从PyPI平台下载安装软件…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;PyPI（Python Package Index）是[[Python]]官方的第三方软件包平台，用于存储和分发python的软件包。[[pip]]默认从PyPI平台下载安装软件包。 &lt;br /&gt;
&lt;br /&gt;
==时间轴==&lt;br /&gt;
&lt;br /&gt;
==发布包到pypi==&lt;br /&gt;
===注册pypi账号===&lt;br /&gt;
在[https://pypi.org/ pypi官网]注册一个账号&lt;br /&gt;
===打包项目===&lt;br /&gt;
====简单项目打包结构====&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;packaging_tutorial/&lt;br /&gt;
  your_project/&lt;br /&gt;
    __init__.py&lt;br /&gt;
  setup.py&lt;br /&gt;
  LICENSE&lt;br /&gt;
  README.md&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
其中：&lt;br /&gt;
*your_project，是项目文件夹&lt;br /&gt;
*setup.py，是告诉setuptools关于包的信息，如名称，版本，包含哪些代码文件夹等。&lt;br /&gt;
*LICENSE，文件为该项目的许可协议&lt;br /&gt;
*README.md，该项目的说明&lt;br /&gt;
&lt;br /&gt;
====编写setup.py====&lt;br /&gt;
一个简单的setup.py如下：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
import setuptools&lt;br /&gt;
&lt;br /&gt;
with open(&amp;quot;README.md&amp;quot;, &amp;quot;r&amp;quot;) as fh:&lt;br /&gt;
    long_description = fh.read()&lt;br /&gt;
&lt;br /&gt;
setuptools.setup(&lt;br /&gt;
    name=&amp;quot;example-pkg-YOUR-USERNAME-HERE&amp;quot;, # Replace with your own username&lt;br /&gt;
    version=&amp;quot;0.0.1&amp;quot;,&lt;br /&gt;
    author=&amp;quot;Example Author&amp;quot;,&lt;br /&gt;
    author_email=&amp;quot;author@example.com&amp;quot;,&lt;br /&gt;
    description=&amp;quot;A small example package&amp;quot;,&lt;br /&gt;
    long_description=long_description,&lt;br /&gt;
    long_description_content_type=&amp;quot;text/markdown&amp;quot;,&lt;br /&gt;
    url=&amp;quot;https://github.com/pypa/sampleproject&amp;quot;,&lt;br /&gt;
    packages=setuptools.find_packages(),&lt;br /&gt;
    classifiers=[&lt;br /&gt;
        &amp;quot;Programming Language :: Python :: 3&amp;quot;,&lt;br /&gt;
        &amp;quot;License :: OSI Approved :: MIT License&amp;quot;,&lt;br /&gt;
        &amp;quot;Operating System :: OS Independent&amp;quot;,&lt;br /&gt;
    ],&lt;br /&gt;
    python_requires=&amp;#039;&amp;gt;=3.6&amp;#039;,&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====编写LICENSE====&lt;br /&gt;
编写许可协议，告诉安装该包的用户，他们能如何使用。可以在https://choosealicense.com/ 选择一个协议复制到LICENSE文件中，如下面的 MIT license：&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;Copyright (c) 2018 The Python Packaging Authority&lt;br /&gt;
&lt;br /&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy&lt;br /&gt;
of this software and associated documentation files (the &amp;quot;Software&amp;quot;), to deal&lt;br /&gt;
in the Software without restriction, including without limitation the rights&lt;br /&gt;
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell&lt;br /&gt;
copies of the Software, and to permit persons to whom the Software is&lt;br /&gt;
furnished to do so, subject to the following conditions:&lt;br /&gt;
&lt;br /&gt;
The above copyright notice and this permission notice shall be included in all&lt;br /&gt;
copies or substantial portions of the Software.&lt;br /&gt;
&lt;br /&gt;
THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&lt;br /&gt;
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&lt;br /&gt;
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&lt;br /&gt;
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&lt;br /&gt;
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&lt;br /&gt;
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE&lt;br /&gt;
SOFTWARE.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====编写README.md====&lt;br /&gt;
可以用Markdown书写该项目的说明，如：&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;# Example Package&lt;br /&gt;
&lt;br /&gt;
This is a simple example package. You can use&lt;br /&gt;
[Github-flavored Markdown](https://guides.github.com/features/mastering-markdown/)&lt;br /&gt;
to write your content. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====生成发行包====&lt;br /&gt;
*首先确认安装了最新的setuptools和wheel&lt;br /&gt;
 python3 -m pip install --user --upgrade setuptools wheel&lt;br /&gt;
*在setup.py所在文件夹运行下面命令打包：&lt;br /&gt;
 python3 setup.py sdist bdist_wheel&lt;br /&gt;
*生成的发行包位于该文件夹下的dist文件夹，dist文件夹包含两个文件，如：&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;dist/&lt;br /&gt;
  example_pkg_YOUR_USERNAME_HERE-0.0.1-py3-none-any.whl&lt;br /&gt;
  example_pkg_YOUR_USERNAME_HERE-0.0.1.tar.gz&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{了解更多&lt;br /&gt;
|[https://packaging.python.org/tutorials/packaging-projects/ Python文档-打包项目]&lt;br /&gt;
}}&lt;br /&gt;
===上传包===&lt;br /&gt;
安装twine：&lt;br /&gt;
 pip install twine&lt;br /&gt;
在项目文件夹，运行命令上次dist文件夹下所有内容：&lt;br /&gt;
 twine upload dist/*&lt;br /&gt;
&lt;br /&gt;
==资源==&lt;br /&gt;
===官网===&lt;br /&gt;
*[https://pypi.org/ PyPI 官网]&lt;br /&gt;
*[https://pypi.org/help/ PyPI 帮助]&lt;br /&gt;
*[https://packaging.python.org/tutorials/installing-packages/ Python 文档：安装第三方包]&lt;br /&gt;
*[https://packaging.python.org/tutorials/packaging-projects/ Python 文档：打包项目]&lt;br /&gt;
&lt;br /&gt;
==参考文献==&lt;br /&gt;
*[https://zh.wikipedia.org/wiki/PyPI 维基百科：PyPI]&lt;br /&gt;
&lt;br /&gt;
[[分类:编程工具]]&lt;/div&gt;</summary>
		<author><name>Eric</name></author>
	</entry>
</feed>