【问题标题】:No matching distribution found for django==3.0 on Ubuntu 16.04在 Ubuntu 16.04 上找不到 django==3.0 的匹配发行版
【发布时间】:2020-05-18 12:18:21
【问题描述】:

我刚刚重新安装了 Ubuntu 16.04,然后做了一个 virtualenv 并尝试使用 Django 安装

sudo pip3 install django==3.0

但这会产生以下错误:

ERROR: Could not find a version that satisfies the requirement django==3.0 
(from versions: 1.1.3, 1.1.4, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5,
 1.2.6, 1.2.7, 1.3, 1.3.1, 1.3.2, 1.3.3, ...  2.2.5, 2.2.6, 2.2.7, 2.2.8, 2.2.9)
ERROR: No matching distribution found for django==3.0

经过搜索,我觉得我的pip版本太低了,所以不知道Django的新版本。我尝试用

升级pip
sudo pip install --upgrade pip

但这给了

WARNING: The directory '/home/hugh/.cache/pip' or 
its parent directory is not owned or is not writable by the current user. 
The cache has been disabled. Check the permissions and owner of that directory. 
If executing pip with sudo, you may want sudo's -H flag.
Requirement already up-to-date: pip in /usr/local/lib/python3.5/dist-packages (20.0.2)

我知道pip的最新版本是20.0.2。

为什么我不能安装 Django 3.0 版?

【问题讨论】:

  • 旁白:不要sudo pip install。您正在将用户安装的包从 PyPI 转储到操作系统提供的 Python 包所在的位置。使用 virtualenvs 或 --user,具体取决于您的具体用例。
  • @Chris 感谢您的提示!但我也在那里使用 virtualenv 和 sudo pip install。使用权也是错的吗?
  • 在 virtualenv 中你可能不需要sudo。每次使用该命令时,请尝试考虑需要它的原因。如果您不需要它,请不要使用它。
  • 我明白了。我只是认为可能有必要使用“sudo”。我不知道。谢谢!
  • 只要确保创建没有sudo的virtualenv,否则你可能会遇到权限问题:-)。

标签: python django pip


【解决方案1】:

您无需更新 pip 即可查找新软件包。它在 PyPI 上查找它们。

Django 3.0 requires Python 3.6 or greaterUbuntu 16.04's python3 package 适用于 3.5 版,其中is supported by Django 2.2

要么升级你的 Python(我建议使用类似 pyenvpythonz 的东西来轻松地将你的 Python 版本与操作系统分离)或使用 Django 2.2。

【讨论】:

  • 哦,谢谢!我的 python 版本是 3.5.2。我想知道如果我升级我的python版本,那么我可以通过pip使用django 3.0吗?
  • 我也遇到了这种错误,因为我没有激活我的虚拟环境。
猜你喜欢
  • 2019-03-10
  • 2019-04-12
  • 1970-01-01
  • 1970-01-01
  • 2018-07-08
  • 2019-12-26
  • 1970-01-01
  • 2019-02-07
  • 2017-06-25
相关资源
最近更新 更多