无法安装pip包

2024-10-05 10:15:58 发布

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

我正在尝试制作我自己的python3pip包。我从命令行使用Thine将其在线上传,我可以在此处在线查看它:

https://pypi.org/project/example-pkg-martinbarker-test/

我完全遵循this教程(除了更改包名),但是如果我尝试使用url中的说明安装包:

pip install example-pkg-martinbarker-test

我得到一个错误:

# pip install example-pkg-martinbarker-test Collecting example-pkg-martinbarker-test Could not find a version that satisfies the requirement example-pkg-martinbarker-test (from versions: ) No matching distribution found for example-pkg-martinbarker-test

是不是因为我将包上载到Thine的方式导致了此错误


Tags: installpip命令行httpsorgtestprojectpypi
2条回答

在使用Python3进行安装时,安装对我有效,但在使用Python2时失败

在这种情况下,请确保您正在为Python 3运行pip。您可能希望为Python3创建一个虚拟环境,并安装该软件包

要创建虚拟环境,请执行以下操作:

virtualenv env -p python3

要激活虚拟环境,请执行以下操作:

source ./env/bin/activate

要检查版本,请执行以下操作:

pip -V

pip 19.3.1 from some/path/env/lib/python3.7/site-packages/pip (python 3.7)

要安装:

pip install example-pkg-martinbarker-test

这将成功安装您提到的软件包

Collecting example-pkg-martinbarker-test
  Downloading https://files.pythonhosted.org/packages/b8/34/9cb503547689819a8c98048eb7127a3538243b0d44294987dba28eeb0259/example_pkg_martinbarker_test-0.0.1-py3-none-any.whl
Installing collected packages: example-pkg-martinbarker-test
Successfully installed example-pkg-martinbarker-test-0.0.1

通过卸载pip并安装pip3,然后使用pip3安装我的软件包修复了此问题

pip安装示例pkg martinbarker测试==0.0.1

多谢各位

相关问题 更多 >

    热门问题