pipenv 安装给出无法加载路径错误

pipenv install giving Failed to load paths errors

我正在 运行ning pipenv install --dev 这给了我以下错误

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing dependencies from Pipfile.lock (2df4c1)…
Failed to load paths: /bin/sh: /Users/XXXX/.local/share/virtualenvs/my-service-enGYxXYk/bin/python: No such file or directory

Output: 
Failed to load paths: /bin/sh: /Users/XXXX/.local/share/virtualenvs/my-service-enGYxXYk/bin/python: No such file or directory

Output: 
Failed to load paths: /bin/sh: /Users/XXXX/.local/share/virtualenvs/my-service-enGYxXYk/bin/python: No such file or directory

我真的不想改变周围的命令我宁愿解决潜在的问题,因为它是其他人正在使用的项目中 package.json 文件的一部分,而不是我只是想 运行 在我自己的机器上..

谢谢

删除您的 Pipfile.lock 并尝试重新运行 pipenv install 以从您的 Pipfile 重建您的依赖项。它正在寻找一个不存在的虚拟环境。通过删除你的 Pipfile.lock,你强制 pipenv 创建一个新环境。

我在 ubuntu 20.04 上发现了类似的错误,如下所示:

frog@ocean:playground/demo-selenium $ pipenv install selenium
Installing selenium...
⠋ Installing...Failed to load paths: /bin/sh: 1: /home/frog/.local/share/virtualenvs/demo-selenium-aj4lh7NL/bin/python: not found

Output: 
⠙ Installing selenium...Failed to load paths: /bin/sh: 1: /home/frog/.local/share/virtualenvs/demo-selenium-aj4lh7NL/bin/python: not found

Output: 
Failed to load paths: /bin/sh: 1: /home/frog/.local/share/virtualenvs/demo-selenium-aj4lh7NL/bin/python: not found

Output: 
Error:  An error occurred while installing selenium!
Error text: 
/bin/sh: 1: /home/frog/.local/share/virtualenvs/demo-selenium-aj4lh7NL/bin/pip: not found

✘ Installation Failed 

我的解决方法是: 当我 运行 pipenv shell 创建一个新的虚拟环境时,只需添加选项 --three--two 来指定 python 版本。 这是因为我的 linux 没有安装 python 2。 然后我又 运行 了,我终于可以安装 selenium 了。

我运行pipenv --python 3.7 然后 pipenv shell --three

对我有用

我在 Windows 中遇到了同样的错误,对我有用的是 运行ning pipenv --rm 然后 pipenv check。然后我能够 运行 pipenv install 没有失败。