当我在我的软件包上运行 pip show
命令 我得到以下内容。
D:\Python\Python\Classeviva>pip show classeviva.py
Name: Classeviva.py
Version: 0.1.1.post1
Summary: Classeviva Python API wrapper
Home-page: https://github.com/Lioydiano/Classeviva
Author: FLAK-ZOSO
Author-email: @gmail.com
License:
Location: c:\users\...\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages
Requires:
Required-by:
特别是字段要求:
是空的,尽管包含在 setup.py
(url的当前版本)。
requires=["requests"]
在一个>也是。在其中我也指定了许可
,所以我不明白 pip
未在字段许可
中显示它。
[build-system]
license = "MIT"
requires = ["setuptools>=42", "requests>=2.27.1"]
build-backend = "setuptools.build_meta"
编辑
这是 d:\\ python \ python \ classeviva
下的文件夹结构,可以在github上在存储库上找到,除 .gitignore
.gitignore d d文件和文件夹。
iguananaut ,通过 pip
使需求可见。
Requires: requests
When I run the pip show
command on my package Classeviva.py
I get the following.
D:\Python\Python\Classeviva>pip show classeviva.py
Name: Classeviva.py
Version: 0.1.1.post1
Summary: Classeviva Python API wrapper
Home-page: https://github.com/Lioydiano/Classeviva
Author: FLAK-ZOSO
Author-email: @gmail.com
License:
Location: c:\users\...\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages
Requires:
Required-by:
In particular the field Requires:
is empty, despite being included in setup.py
(current version at url).
requires=["requests"]
And in pyproject.toml
too. In it I specified license
too, so I don't get why pip
isn't showing it in the field license
.
[build-system]
license = "MIT"
requires = ["setuptools>=42", "requests>=2.27.1"]
build-backend = "setuptools.build_meta"
Edit
This is the folder structure under D:\\Python\Python\Classeviva
, it can be found on GitHub at the repository, except for .gitignore
d files and folders.

Edit (1)
Adding install_requires='requests>=2.27'
as argument to the setuptools.setup
call, as suggested below by Iguananaut
, made the requirement visible via pip
.
Requires: requests
发布评论
评论(1)
使用
setup.py
文件几乎是弃用的(有利于staticsetup.cfg
文件)。更重要的是,需要=
关键字是较旧的distifact,在setuptools中根本没有真正使用。您想要的是欺骗性的类似
install_requires ='请求> = 2.27'
putting
quode> regigns = ['requests']
inpyproject.toml
is ,除非您确切地知道自己在做什么,否则毫无用处。此需要
是您项目的构建系统所需的内容,并且与项目的运行时要求无关。欢迎来到任何令人困惑的Python包装世界。
Use of
setup.py
files are all but deprecated (in favor of staticsetup.cfg
files). What's more, therequires=
keyword is an even older artifact of distutils and is not really used at all in setuptools.What you want here is the deceptively similar
install_requires='requests>=2.27'
Putting
requires=['requests']
inpyproject.toml
is, unless you know exactly what you're doing, pretty useless. Thisrequires
is just what the build system for your project requires, and has no connection to the runtime requirements of your project.Welcome to the not at all confusing world of Python packaging.