python-3.x - 对于两个版本的 python,我的 pip 都不起作用
问题描述
所以我已经安装了 python 2.7 和 python 3.8 但是在 cmd 中如果我输入以下之一:
点安装
点子--版本
它使用 python 2.7 版本。我不认为我可以使用随 python 3 安装的软件包。我尝试过:
重新安装 python (2 & 3)
将其添加到我的 PATH
更改保存它的目录
Pip3 命令
引导点
但是没有一个起作用。(我也在 Windows 7 上,并且需要 pip 和 python 用于 2.7 和 3.8)
当我使用:
python3 -m pip install x
或者
py -3 -m 点安装 x
它提出了:
导入 pyexpat 时 DLL 加载失败:找不到指定的模块
解决方案
看看官方文档,
如果你在 Windows 上,你可以使用,
py -2 -m pip install SomePackage # default Python 2
py -2.7 -m pip install SomePackage # specifically Python 2.7
py -3 -m pip install SomePackage # default Python 3
py -3.4 -m pip install SomePackage # specifically Python 3.4
在 Linux、Mac OS X 和其他 POSIX 系统上,使用版本化的 Python 命令和 -m 开关来运行适当的 pip 副本:
python2 -m pip install SomePackage # default Python 2
python2.7 -m pip install SomePackage # specifically Python 2.7
python3 -m pip install SomePackage # default Python 3
python3.4 -m pip install SomePackage # specifically Python 3.4
希望这可以帮助!
推荐阅读
- sql - 如何获取按月排序的数据
- javascript - 为什么不能设置null显示的属性innerhtml
- .net - 此主机上安装了哪个 .NET 版本?
- keras - 在 Keras 中,在模型中使用 Lambda 时无法保存模型检查点。报错 ValueError: can only convert a array of size 1 to a Python scalar
- jquery - 单击复选框时禁用和启用 Jquery Button
- java - Kotlin 生成私有字段:@MyAnnotation 字段不能是私有或静态的
- javascript - 如何处理从父 Promise 链返回的具有各种可能结果的 Promise
- sql - 如何在oracle sql developer中获取用户的FID
- javascript - 如何在运行时跟踪 DIV 的子元素计数?
- azure - ASP .Net 核心项目 CI\CD 在使用 DevOps 项目发布时失败