我的Python软件包可以安装在我的本地Conda Env上,但不能安装在其他Envs或Systems上

发布于 2025-01-28 14:46:32 字数 1247 浏览 1 评论 0 原文

我已经创建了自己的python软件包,然后将其上传到 https://test.pypi.org/ 并且在我的conda虚拟环境中工作正常,但是当我想在其他系统或环境上安装它时,似乎无法安装依赖项。 我遇到此错误:

ERROR: You must give at least one requirement to install (see "pip help install")

我的setup.py文件是:

from setuptools import setup, find_packages

with open("README.md", "r", encoding="utf-8") as fh:
    long_description = fh.read()

setup(
    name = "mypackage",
    version = "0.0.31",
    author = "my name",
    author_email= "[email protected]",
    description = "a description",
    long_description = long_description,
    long_description_content_type = "text/markdown",
    packages = ["mypackage"],
    python_requires = ">=3.9",
    install_requires = [
        "pandas>=1.4.2",
        "pyro-api>=0.1.2",
        "pyro-ppl>=1.8.0",
        "numpy>=1.21.5",
        ],
)

我在 ubuntu 22.04 上,并使用以下命令安装软件包:

  • python setup.py sdist
  • twine上传 - reposority testpipi dist/mypackage-0.0.0.0 。
  • ​/a>

I have created my own python package and uploaded it in https://test.pypi.org/ which installed and worked fine in my conda virtual environment but when I want to install it on other systems or environments, it seems that it cant install the dependencies.
i get this error:

ERROR: You must give at least one requirement to install (see "pip help install")

my setup.py file is:

from setuptools import setup, find_packages

with open("README.md", "r", encoding="utf-8") as fh:
    long_description = fh.read()

setup(
    name = "mypackage",
    version = "0.0.31",
    author = "my name",
    author_email= "[email protected]",
    description = "a description",
    long_description = long_description,
    long_description_content_type = "text/markdown",
    packages = ["mypackage"],
    python_requires = ">=3.9",
    install_requires = [
        "pandas>=1.4.2",
        "pyro-api>=0.1.2",
        "pyro-ppl>=1.8.0",
        "numpy>=1.21.5",
        ],
)

I'm on Ubuntu 22.04 and using following commands to install the package:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏大泽ㄣ 2025-02-04 14:46:32

在命令中,

pip install -i https://test.pypi.org/simple/mypackage

您仅提供索引,但不提供要求。正确的语法

pip install -i https://test.pypi.org/simple/ mypackage

也与

pip install -i https://test.pypi.org/simple/ mypackage

您一起允许PIP仅在test.pypi.org中安装,并且在 pandas> = 1.3.3 /project/pandas“ rel =“ nofollow noreferrer”> https://test.pypi.org/project/prandas/pandas 。您需要允许PIP使用pypi.org。这边走:

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

In the command

pip install -i https://test.pypi.org/simple/mypackage

you provide only the index but not the requirement(s). The correct syntax is

pip install -i https://test.pypi.org/simple/ mypackage

Also with

pip install -i https://test.pypi.org/simple/ mypackage

you allowed pip to install only from test.pypi.org and there is no pandas>=1.3.3 at https://test.pypi.org/project/pandas. You need to allow pip to use pypi.org. This way:

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple mypackage
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文