Pipenv Install RuntimeError: location not created nor specified

Pipenv Install RuntimeError: location not created nor specified

我正在使用 Pipenv 来管理项目依赖项。到目前为止,它工作正常。现在,我正在尝试 bootstrap 具有 pipenv install 的环境,但出现以下错误:

❯ pipenv install --dev --skip-lock
Creating a virtualenv for this project…
Pipfile: /Users/user/project/Pipfile
Using /usr/bin/python3 (3.7.3) to create virtualenv…
⠧ Creating virtual environment...created virtual environment CPython3.7.3.final.0-64 in 399ms
  creator CPython3Posix(dest=/Users/user/.local/share/virtualenvs/sql_runner-ABIm84c6, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/Users/user/Library/Application Support/virtualenv/seed-app-data/v1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

✔ Successfully created virtual environment!
Virtualenv location: /Users/user/.local/share/virtualenvs/sql_runner-ABIm84c6
Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/cli/command.py", line 235, in install
    retcode = do_install(
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/core.py", line 1734, in do_install
    ensure_project(
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/core.py", line 579, in ensure_project
    path_to_python = which("python") or which("py")
  File "/usr/local/Cellar/pipenv/2018.11.26_4/libexec/lib/python3.8/site-packages/pipenv/core.py", line 108, in which
    raise RuntimeError("location not created nor specified")
RuntimeError: location not created nor specified

Pipfile如下

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
pytest     = "==4.6.3"
flake8     = "==3.7.7"
autopep8   = "==1.4.4"
pytest-cov = "==2.7.1"
moto       = "==1.3.13"
Sphinx     = "==2.3.1"

[packages]
psycopg2-binary          = "==2.8.2"
boto3                    = "==1.9.166"
pymongo                  = "==3.8.0"
deprecated               = "==1.2.5"
paramiko                 = "==2.6.0"
pandas                   = "==0.24.2"
pyarrow                  = "==0.14.0"
SQLAlchemy               = "==1.3.15"
s3fs                     = "==0.4.0"

[requires]
python_version = "3.7"

我已经用 Homebrew 安装了 Pipenv。我不确定会发生什么变化以停止工作。其他较旧的项目仍在运行,但每次我尝试创建环境时都会收到此错误。

谢谢!

所以我设法让它发挥作用。我的默认 python 系统安装是 3.7.3。但是,出于某种原因,pipenv 不喜欢那个。我用自制软件安装了 python 3.7.7,pipenv 能够正确找到该版本并使用它来创建虚拟环境。

总而言之,要解决此问题,请尝试重新安装 python。就我而言:

brew install python