python - pipenv 的问题
问题描述
我正在尝试创建一个虚拟环境。为此,我从终端安装 pipenv:
>pip install pipenv
没问题。
然后,当试图安装一个包,或者从 pipenv 做任何事情时,我做不到。
>pipenv install requests
错误:
pipenv : The term 'pipenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pipenv install requests
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (pipenv:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
请帮我!我已经尝试过使用旧版本的 pipenv 包,但我不知道发生了什么。
解决方案
利用python -m pip install requests
发生这种情况是因为系统中存储的 python 版本不同,并且与该版本关联的 pip 不同。
例如:在您的系统中,默认 python 可以是 2.7,python 3 版本可以是 3.6。它通过运行python
和python3
分别在终端中调用。
现在,如果您使用pip
( pip install requests
),那么它将在 python2.7 中安装请求,即 pip 关联的默认请求。
不使用 python3.6 安装,您需要调用与它关联的 pip pip3 install requests
。
所以这会造成混乱。因此,如果您使用 python 调用命令调用 pip 是一个好习惯,即python -m pip install <package name>
所以这会将包安装在您正在工作或想要工作的python环境中。
推荐阅读
- swagger - APIM 中的自动更新 OpenAPI 规范
- c# - 如何将泛型类型对象传递给类构造函数
- amazon-web-services - Cloud9 给出不同的卷曲响应
- c++builder - Embarcadero C++Builder 10.4 会有社区版吗?
- react-native - 所有 react-native-paper 组件都会抛出关于 Accessibility API 的类型错误
- python - 在 django 模型中,外键没有检索实际值
- flutter - 如何使用dio在flutter中成功响应时导航到不同的屏幕
- java - 将 springboot 升级到 2.4.2 版本后,@ActiveProfiles 注释不起作用
- linux - 如何从提交对象 git ls-tree?
- jakarta-mail - Jakarta Mail OAUTH 通过 POP 协议支持 Office365