因此,在空闲时间进行了几周的编码后,我决定将我的第一个包发布到PYPI。
我遵循了我在Medium上找到的关于如何发布到PYPI和创建setup.py
的好指南。我遵循了官方文档上链接的示例脚本,但现在我正试图在全新的venv中测试该包,但我在安装它时遇到了问题。安装脚本给出了以下错误:
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-n98_mli9/gisterical_9bbb85fbb9174141b0879737b7b585c1/setup.py", line 7, in <module>
long_description = (here / "readme.md").read_text(encoding="utf-8")
File "/usr/lib64/python3.10/pathlib.py", line 1134, in read_text
with self.open(mode='r', encoding=encoding, errors=errors) as f:
File "/usr/lib64/python3.10/pathlib.py", line 1119, in open
return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-n98_mli9/gisterical_9bbb85fbb9174141b0879737b7b585c1/readme.md'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
我不完全确定我哪里错了。这是我的setup.py
from setuptools import setup, find_packages
import pathlib
here = pathlib.Path(__file__).parent.resolve()
long_description = (here / "readme.md").read_text(encoding="utf-8")
setup(
name='GISterical',
version='0.5.3',
license='MIT',
author="Pavel Cherepanskiy",
author_email='pavelcherepansky@gmail.com',
packages=find_packages('src'),
package_dir={'': 'src'},
url='https://github.com/pavelcherepan/gisterical',
long_description=long_description,
long_description_content_type="text/markdown",
keywords='example project',
classifiers=[
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
],
python_requires=">=3.9, <4",
install_requires=[
'loguru',
'SQLAlchemy>=1.4',
'GeoAlchemy2>=0.12',
'exif',
'attrs',
'ImageHash',
'Pillow',
'psycopg2-binary>=2.8'
],
entry_points={
"console_scripts": [
"gisterical=gisterical:gisterical",
],
},
)
还有我的setup.cfg
[metadata]
description-file=readme.md
license_files=LICENSE.rst
我真的不明白readme.md
的问题是什么,因为它在PYPI项目页面上显示正确。
您忘记将readme.md
添加为数据文件。请注意,只有README*
文件会自动包含在内。将readme.md
文件重命名为README.md
,或使用MANIFEST.in
将其添加为数据文件。