簡體   English   中英

Django安裝錯誤

[英]Django installation error

我安裝了python 3.5.2。 我還安裝了pip 9.0.1。 當我輸入命令pythonpip --version時,將顯示版本號。 但是,當我嘗試使用命令pip install Django ,經過一定百分比后,它將停止下載,並且在命令提示符下出現以下錯誤。 我試圖設置路徑,但仍然顯示錯誤。

Exception:
Traceback (most recent call last):
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 232, in_error_catcher
yield
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 314, in read
data = self._fp.read(amt)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read
data = self.__fp.read(amt)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\http\client.py", line 448, in read
n = self.readinto(b)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\http\client.py", line 488, in readinto
n = self.fp.readinto(b)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\socket.py",line 575, in readinto
return self._sock.recv_into(b)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\ssl.py", line 929, in recv_into
return self.read(nbytes, buffer)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\ssl.py", line 791, in read
return self._sslobj.read(len, buffer)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\ssl.py", line 575, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 821, in unpack_url
hashes=hashes
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 659, in unpack_http_url
hashes)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\utils\hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 571, in written_chunks
for chunk in chunks:
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\utils\ui.py", line 139, in iter
for x in it:
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\download.py", line 560, in resp_read
decode_content=False):
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 357, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 324, in read
flush_decoder = True
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\dell\appdata\local\programs\python\python35-32\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 237, in_error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError:HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

追溯告訴您的是,分配給一個讀取操作的最長時間已花費,因此該操作被中止。 這可能是由於連接速度較低,在這種情況下,快速解決方案可能是增加安裝軟件包的超時時間。 嘗試這個:

pip --default-timeout=500 install django

其中500是秒數。 隨意增加/減少它。 希望能幫助到你。

您應該使用virtualenv

創建一個虛擬環境。 然后安裝django: pip install django ,而不是Django

SOF:如何離開/退出/停用python virtualenv? 鏈接

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM