我正在尝试安装 Scipy 以在 Jupyter 上运行(在 VirtualBox Ubuntu OS、Windows 主机中)。我输入以下命令并出现错误。我该如何修复它?
python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
Requirement already satisfied: numpy in /home/anaconda3/lib/python3.7/site-packages (1.17.0)
Collecting scipy
Downloading https://files.pythonhosted.org/packages/94/7f/b535ec711cbcc3246abea4385d17e1b325d4c3404dd86f15fc4f3dba1dbb/scipy-1.3.1-cp37-cp37m-manylinux1_x86_64.whl (25.2MB)
|▏ | 174kB 5.9kB/s eta 1:10:27ERROR: Exception:
Traceback (most recent call last):
File "/home/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 425, in _error_catcher
yield
File "/home/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 507, in read
data = self._fp.read(amt) if not fp_closed else b""
File "/home/anaconda3/lib/python3.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
data = self.__fp.read(amt)
File "/home/anaconda3/lib/python3.7/http/client.py", line 447, in read
n = self.readinto(b)
File "/home/anaconda3/lib/python3.7/http/client.py", line 491, in readinto
n = self.fp.readinto(b)
File "/home/anaconda3/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/home/anaconda3/lib/python3.7/ssl.py", line 1052, in recv_into
return self.read(nbytes, buffer)
File "/home/anaconda3/lib/python3.7/ssl.py", line 911, in read
return 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 "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
status = self.run(options, args)
File "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 382, in run
resolver.resolve(requirement_set)
File "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 201, in resolve
self._resolve_one(requirement_set, req)
File "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 313, in _get_abstract_dist_for
req, self.session, self.finder, self.require_hashes
File "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 194, in prepare_linked_requirement
progress_bar=self.progress_bar
File "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/download.py", line 465, in unpack_url
progress_bar=progress_bar
File "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/download.py", line 316, in unpack_http_url
progress_bar)
File "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/download.py", line 551, in _download_http_url
_download_url(resp, link, content_file, hashes, progress_bar)
File "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/download.py", line 253, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/home/anaconda3/lib/python3.7/site-packages/pip/_internal/utils/hashes.py", line 80, in check_against_chunks
...
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
答案1
错误出现在您提供的跟踪中:socket.timeout: The read operation timed out
看起来您的互联网连接断断续续或断开。
您使用pip
而不是有什么理由吗conda
?
您可以使用以下方式安装 scipyconda install -c anaconda scipy