我需要在Python中部署一个库,并尝试使用pip来pip install
它,但是在上传库之后,它只安装了一个信息文件:“oauth2clientz.egg info”
注意:我的库名是oauth2clientz:
我遵循的步骤如下:
创建一个名为oauth2clientz的文件夹
创建License.txt文件将我自己的许可证放入其中
在文件中创建Manifest.in并编写以下代码:
global-include *.txt *.py
创建setup.py文件并编写以下代码:
from setuptools import setup, find_packages
setup(
name='oauth2clientz',
version='0.0.1',
description='oauth2clientzskproject',
long_description='outh2client',
long_description_content_type='text/plain',
url='https://github.com/sukan/oauth2clientz',
author='sukan',
author_email='sukanpp@gmail.com',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
keywords='oauth2clientz project',
)
在此文件夹中创建新文件夹,将其命名为oauth2clientz,并将所有我的库文件放入其中,包括(__init__.py
)
转到第一个OAuth2Client文件夹的cmd并输入:
python setup.py sdist
它将生成这两个文件夹:“oauth2clientz.egg info”和“dist”
最后,输入cmd:
twipe upload --repository-url https://upload.pypi.org/legacy/ dist/*
enter username:
enter password:
完成后,它被部署到Python org,但当我使用pip install oauth2clientz
安装它时,它只安装了这个信息文件夹:“oauth2clientz.egg info”,它没有安装我添加到oauth2clientz文件夹中的库
为什么??我的工作哪里不对?我应该在setup.py
文件中添加任何内容吗
正如@Klaus D所说的,您缺少
packages
根据最近的最佳实践(
src layout
、pyproject.toml
、setup.cfg
..),您的包通常应具有以下结构:src/oauth2clientz/__;init.py
在
setup.cfg
pyproject.toml
如果您在windows上,并且希望生成和发布包
希望它能正常工作
相关问题 更多 >
编程相关推荐