成功安装后无法运行pipenv

时间:2021-01-05 20:14:20

标签: python pipenv

我知道之前有人问过这个问题,我查看了以前的帖子,但没有一个解决了我的问题。

我是编程新手,所以我可能会混淆术语,但我会尽量详细解释。

我在 Visual Studio Code 上运行 Python 3.8。我成功安装了pipenv:

python -m pip install pipenv

然后我尝试实际使用它并得到这个错误:

    pipenv shell --python 3.8
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 shell --python 3.8
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (pipenv:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

在安装过程中我收到了这个警告:

WARNING: The script f2py.exe is installed in 'C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

但是,我实际上不知道如何执行此操作,甚至不知道我是否应该执行此操作,因为我安装的每个软件包都会收到此警告,但无论如何它都可以正常工作。

我正在学习本教程: Video Tutorial

那个人特别说要在我们项目所在的目录中运行 pipenv 命令,我正在这样做,但我收到了这个错误。尽管如此,我还是尝试 cd 到安装 pipenv 的目录并出现相同的错误。

顺便说一句,我使用的是 Win 10。我做错了什么?

2 个答案:

答案 0 :(得分:0)

您可能需要将 pipenv 添加到您的路径变量中。查看 the docs 中的注释部分。它实际上描述了如何在 Windows 上获得正确的添加位置:

<块引用>

在 Windows 上,您可以通过运行找到用户库二进制目录 python -m site --user-site 并用脚本替换站点包。 例如,这可能会返回 C:\Users\Username\AppData\Roaming\Python36\site-packages 这样你就可以 需要将您的 PATH 设置为包括 C:\Users\Username\AppData\Roaming\Python36\Scripts。你可以设置你的 用户 PATH 永久位于控制面板中。您可能需要注销 使 PATH 更改生效。

这应该能让你的终端识别它。

最后一句话让我想起了(自从我使用 Windows 以来已经有一段时间了)-您是否尝试过重新启动或注销?老实说,我不确定这是否有必要,但我知道有时确实如此。

长话短说(并且仅因为您提到您是编程新手)--“路径”列出了可从中执行的所有位置。如果您希望能够执行新程序,例如 pipenv,您可以添加它。

答案 1 :(得分:0)

这就是为我解决问题的原因(Windows 10):

我添加了我实际运行的 Python 版本的正确 Scripts 文件夹。就我而言,这是 C:\python\Scripts。我在控制面板中添加了它 - 搜索“环境” - 编辑环境变量(针对我的帐户和系统范围 - 在两个地方都做了,只是为了确定,可能是多余的) - 路径 - 编辑 - 添加了路径,现在是问题解决了。谢谢!!! ——

相关问题