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)

最佳答案

您将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

关于python - python setup_tools install_required,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54743649/

10-12 21:39