首页 > 解决方案 > 即使似乎已安装 pipenv,也无法使用 pipenv 安装 Django

问题描述

我正在使用 Python 3.8.1:

$ python -V
Python 3.8.1

我已经安装了 pipenv:

$ pip list | grep pipenv
pipenv                         2018.11.26

如果我尝试安装 Django,我会收到以下错误:

$ pipenv install django
pyenv: pipenv: command not found

The `pipenv' command exists in these Python versions:
  3.7.2

我是否做错了什么导致 pipenv 无法与 3.8.1 一起使用,我该如何解决?

标签: pythonpython-3.xbashpippipenv

解决方案


我不是 pipenv 用户,但您的 pipenv 似乎已经在您的系统上安装了 python 3.7.2,而不是默认的 python 3.8.1。

这可能是因为您在 env 中的 pip 实际上适用于您系统上的 python 3.7.2。

一种可能的解决方案:

  1. 卸载使用 python 3.7.2 安装的 pipenv
   pip uninstall pipenv
  1. 使用 python 3.8.1 安装 pipenv
   python -m pip install pipenv
  1. 使用 pipenv 安装 Django
   python -m pipenv install django

推荐阅读