Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x Can';是否使用pip3安装Djangorest框架?_Python 3.x_Ubuntu_Django Rest Framework_Pip - Fatal编程技术网

Python 3.x Can';是否使用pip3安装Djangorest框架?

Python 3.x Can';是否使用pip3安装Djangorest框架?,python-3.x,ubuntu,django-rest-framework,pip,Python 3.x,Ubuntu,Django Rest Framework,Pip,我一直在努力 pip3 install djangorestframework 我得到了这个结果: Collecting djangorestframework Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected me

我一直在努力

pip3 install djangorestframework
我得到了这个结果:

Collecting djangorestframework
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),)': /simple/djangorestframework/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),)': /simple/djangorestframework/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),)': /simple/djangorestframework/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),)': /simple/djangorestframework/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),)': /simple/djangorestframework/
  Could not find a version that satisfies the requirement djangorestframework (from versions: )
No matching distribution found for djangorestframework
我正在使用python3,这就是我使用pip3的原因

编辑只是为了进一步澄清。。。这仅在安装和卸载此软件包时发生。我用pytz进行了测试,我可以自由安装和卸载

此外,pip3 search还会抛出相同的SSL错误,然后向我吐露这一点:

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),)': /pypi
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),)': /pypi
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),)': /pypi
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),)': /pypi
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),)': /pypi
Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py", line 852, in _validate_conn
    conn.connect()
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/util/ssl_.py", line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "/usr/lib/python3.6/ssl.py", line 817, in __init__
    self.do_handshake()
  File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py", line 668, in urlopen
    **response_kw)
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py", line 668, in urlopen
    **response_kw)
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py", line 668, in urlopen
    **response_kw)
  [Previous line repeated 2 more times]
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi (Caused by SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/search.py", line 45, in run
    pypi_hits = self.search(query, options)
  File "/usr/lib/python3/dist-packages/pip/commands/search.py", line 62, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/usr/lib/python3/dist-packages/pip/download.py", line 775, in request
    headers=headers, stream=True)
  File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/sessions.py", line 567, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/sessions.py", line 520, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/sessions.py", line 630, in send
    r = adapter.send(request, **kwargs)
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi (Caused by SSLError(SSLError(1, '[SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:852)'),))

检查是否满足以下要求:

要求 REST框架需要以下内容:

Python(3.5,3.6,3.7)Django(1.11,2.0,2.1,2.2)

我们高度评价 建议并仅正式支持每个版本的最新补丁 Python和Django系列


我建议您使用django==2.2安装需求。然后,如果您需要Django3及更高版本,请在安装所有其他需求之后再安装它。虽然您将看到依赖项错误,但它将正常工作。

这看起来像是网络问题。您是否能够使用
pip3
安装其他软件包?您使用的是哪个python发行版?我使用的是python 3.6.8和Django 2.2,我还可以安装其他软件包。我刚刚卸载并重新安装了pytz到testPython,python 3.6.8是python版本,但是您是如何安装的?通过
apt
,通过下载它,或者你有
anaconda
…?通过aptI,我正在使用Python 3.6.8和Django 2.2。因此,基于此,我认为它应该仍然工作?它似乎是ssl问题,您无法与PyPi通信。尝试升级您的pip:pip安装--upgrade pip--trusted host pypi.org--trusted host files.pythonhosted.org我在Mac上设置项目时遇到了同样的问题。我已经解决了这个问题:我尝试了这个,但是现在我只有PIP19.3.1,没有pip3。我需要pip3来和python3一起使用,不是吗?不是用venv。只为这个项目运行一个虚拟机,所以我想我会跳过它。