python - 无法安装 pip 包
问题描述
我正在尝试制作自己的 python3 pip 包。我从命令行使用 twine 在线上传了它,我可以在这里在线看到它:
https://pypi.org/project/example-pkg-martinbarker-test/
我完全按照本教程进行操作(除了更改包名称),但是如果我尝试使用 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
是否与我将包裹上传到麻线的方式有关,这会导致此错误吗?
解决方案
使用 Python 3 安装时,安装对我有用,而使用 Python 2 时安装失败。
在这种情况下,请确保您正在pip
为 Python 3 运行。您可能希望为 Python 3 创建一个虚拟环境,并安装该包。
创建虚拟环境:
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
推荐阅读
- linux - GCP VM 实例中的进程自动终止
- pdf - AppleScript/Automator:使用此 PDF 的提取文本内容重命名 PDF
- subdomain - 具有域指向的经销商 Web 应用程序
- oauth-2.0 - 从 3rd 方 API 获取令牌后,我应该生成自己的令牌吗?
- react-native - 使用官方文档创建一个演示 react-native 应用程序
- entity-framework - .Net Core EF re 包括手段
- performance - 现代 CPU 是否需要花费大量资源来保持标志更新?
- php - 用和不用逗号替换子字符串
- react-native - 如何编译 react-native android?
- android - Android Studio 上对 Android TV 的 Play 商店支持