pipenv安装给出失败的加载路径错误

时间:2020-08-10 14:03:42

标签: python pipenv pipenv-install

我正在运行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文件的一部分,而不是我只是尝试在自己的计算机上运行的项目..

谢谢

3 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

我在 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。

答案 2 :(得分:0)

我跑了 pipenv --python 3.7 然后pipenv shell --three

它对我有用