我的 python 包可以安装在我本地的 conda env 上,但不能安装在其他 envs 或系统上
my python package can be installed on my local conda env but can not be installed on other envs or systems
我已经创建了自己的 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@gmail.com",
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 上传 --repository testpypi dist/mypackage-0.0.31.tar.gz
- pip 安装-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 install -i https://test.pypi.org/simple/ mypackage
您只允许从 test.pypi.org 安装 pip,https://test.pypi.org/project/pandas 上没有 pandas>=1.3.3
。您需要允许 pip 使用 pypi.org。这样:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple mypackage
我已经创建了自己的 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@gmail.com",
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 上传 --repository testpypi dist/mypackage-0.0.31.tar.gz
- pip 安装-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 install -i https://test.pypi.org/simple/ mypackage
您只允许从 test.pypi.org 安装 pip,https://test.pypi.org/project/pandas 上没有 pandas>=1.3.3
。您需要允许 pip 使用 pypi.org。这样:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple mypackage