0

我的环境:Windows10 64,Python 3.7,Django 2.2,IDE:VSC

我安装了env并激活了。我正在尝试使用命令安装 djangorestframework

pipenv install djangorestframework

错误:

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1074: The handshake operation timed out'))': /simple/djangorestframework/
ERROR: Could not find a version that satisfies the requirement djangorestframework
ERROR: No matching distribution found for djangorestframework   

这是我在环境中安装的内容。

python -m pip list

Package             Version
------------------- -------
astroid             2.4.2
colorama            0.4.4
Django              2.2
isort               5.6.4
lazy-object-proxy   1.4.3
mccabe              0.6.1
pip                 20.3
pylint              2.6.0
pylint-django       2.3.0
pylint-plugin-utils 0.6
pytz                2020.4
setuptools          50.3.2
six                 1.15.0
sqlparse            0.4.1
toml                0.10.2
typed-ast           1.4.1
wheel               0.35.1
wrapt               1.12.1

当我存在 env 并尝试 pip install djangorestframe 时,它​​起作用了。我在环境中错过了什么?请帮我安装这个框架。谢谢你。

4

3 回答 3

0

根据此链接:https ://dev.to/habibaudu/simple-rest-api-with-django-rest-framework-4bmc

您可以使用 pipenv 安装 django-rest-framework: pipenv install djangorestframework

然后你应该将 django-rest-framework 添加到 settings.py 文件中的 INSTALLED_APPS 中。

INSTALLED_APPS = [ 'django.contrib.admin', 'rest_framework', ]

于 2021-04-08T18:23:10.803 回答
0

用这个代替另一个

pipenv 安装 rest_framework

于 2021-02-17T09:59:38.527 回答
0

尝试升级您的点子类型

python -m pip install --upgrade pip

于 2020-12-26T08:22:07.927 回答