Python安装工具安装所需

2024-05-23 14:39:22 发布

您现在位置:Python中文网/ 问答频道 /正文

import setuptools
with open("README.md", "r") as fh:
    long_description = fh.read()

setuptools.setup(
    name="mylidar",
    version="0.1",
    author="xxxxxxxxxx",
    author_email="xxxxxxxxxx",
    description="xxxxxxxxxxxxxxxxxxxxxxxxxx",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    packages=["xxxxxxxxxxx"],
    install_requires=[
        'pyserial',
    ],
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
)

我想把我的包发布到https://test.pypi.org。我使用命令

python setup.py sdist bdist_wheel

python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*

我成功地将我的项目上传到pypi中,但是当我使用pip重新安装它时,我得到了一个错误

>>pip install -i https://test.pypi.org/simple/ mylidar
Looking in indexes: https://test.pypi.org/simple/
Collecting lidar
  Downloading https://test-files.pythonhosted.org/packages/fb/f0/c7b2e9002550d775625f789e4917969a58b9a8c0495c18500fed8545e321/lidar-0.1-py3-none-any.whl
Collecting pyserial (from lidar)
  Could not find a version that satisfies the requirement pyserial (from lidar) (from versions: )
No matching distribution found for pyserial (from lidar)

Tags: fromhttpsorgtestpypiversionsetupdescription
1条回答
网友
1楼 · 发布于 2024-05-23 14:39:22

您将pyserial命名为依赖项。使用pip install index …安装时,将默认索引替换为test.pypi.orgthere is no pyserial。你知道吗

要允许安装依赖项,请尝试添加PyPI作为额外索引:

pip install -i https://test.pypi.org/simple/  extra-index-url https://pypi.org/simple/ mylidar

相关问题 更多 >