本文共 3680 字,大约阅读时间需要 12 分钟。
转载区块链博客
需要python3版本
1.安装安装 Node.js 和 NPM
Node.js 网站:
并且升级最新版本npm install npm@latest -g
2.安装Windows 构建工具
npm install --global --production windows-build-tools
3.安装 Python 最新版本
转到官方 Python 网站并下载适用于 Windows 的最新 3.x 可执行版本并运行安装文件。Python 下载页面:https://www.python.org/downloads/windows/
勾选在 Python 安装步骤中为所有用户选项添加 Python 到 PATH 选项和安装启动程序。
在下一步中勾选 pip 和 py 启动器选项并安装 Python。
4.升级
python -m pip install --upgrade pip
5.安装 web3.py
pip install web3 -i https://pypi.douban.com/simple
报错
2ERROR: Exception:Traceback (most recent call last): File "f:\py3\lib\site-packages\pip\_vendor\urllib3\response.py", line 425, in _error_catcher yield File "f:\py3\lib\site-packages\pip\_vendor\urllib3\response.py", line 507, in read data = self._fp.read(amt) if not fp_closed else b"" File "f:\py3\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read data = self.__fp.read(amt) File "f:\py3\lib\http\client.py", line 454, in read n = self.readinto(b) File "f:\py3\lib\http\client.py", line 498, in readinto n = self.fp.readinto(b) File "f:\py3\lib\socket.py", line 669, in readinto return self._sock.recv_into(b) File "f:\py3\lib\ssl.py", line 1241, in recv_into return self.read(nbytes, buffer) File "f:\py3\lib\ssl.py", line 1099, in read return self._sslobj.read(len, buffer)socket.timeout: The read operation timed outDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "f:\py3\lib\site-packages\pip\_internal\cli\base_command.py", line 186, in _main status = self.run(options, args) File "f:\py3\lib\site-packages\pip\_internal\commands\install.py", line 331, in run resolver.resolve(requirement_set) File "f:\py3\lib\site-packages\pip\_internal\legacy_resolve.py", line 177, in resolve discovered_reqs.extend(self._resolve_one(requirement_set, req)) File "f:\py3\lib\site-packages\pip\_internal\legacy_resolve.py", line 333, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "f:\py3\lib\site-packages\pip\_internal\legacy_resolve.py", line 282, in _get_abstract_dist_for abstract_dist = self.preparer.prepare_linked_requirement(req) File "f:\py3\lib\site-packages\pip\_internal\operations\prepare.py", line 480, in prepare_linked_requirement local_path = unpack_url( File "f:\py3\lib\site-packages\pip\_internal\operations\prepare.py", line 282, in unpack_url return unpack_http_url( File "f:\py3\lib\site-packages\pip\_internal\operations\prepare.py", line 158, in unpack_http_url from_path, content_type = _download_http_url( File "f:\py3\lib\site-packages\pip\_internal\operations\prepare.py", line 303, in _download_http_url for chunk in download.chunks: File "f:\py3\lib\site-packages\pip\_internal\utils\ui.py", line 160, in iter for x in it: File "f:\py3\lib\site-packages\pip\_internal\network\utils.py", line 15, in response_chunks for chunk in response.raw.stream( File "f:\py3\lib\site-packages\pip\_vendor\urllib3\response.py", line 564, in stream data = self.read(amt=amt, decode_content=decode_content) File "f:\py3\lib\site-packages\pip\_vendor\urllib3\response.py", line 529, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "f:\py3\lib\contextlib.py", line 131, in __exit__ self.gen.throw(type, value, traceback) File "f:\py3\lib\site-packages\pip\_vendor\urllib3\response.py", line 430, in _error_catcher raise ReadTimeoutError(self._pool, None, "Read timed out.")pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
切换源即可
pip install web3 -i https://pypi.douban.com/simple
参考