Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | Github | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

第 12 章 web3.py - A python interface for interacting with the Ethereum blockchain and ecosystem.

目录

12.1. 安装 web3.py 开发环境
12.1.1. CentOS
12.1.2. MAC OS
12.2. 连接到以太坊节点
12.2.1. HTTP
12.2.2. IPC
12.2.3. Websocket
12.3. 交易
12.3.1. 发送 ETH
12.3.2. 签名发送 ETH
12.4. ERC20 代币合约
12.4.1. 签名发送ERC20代币

文档地址 http://web3py.readthedocs.io/

12.1. 安装 web3.py 开发环境

12.1.1. CentOS

			
[root@iZj6c39y62jl5b1wmfv6u8Z ~]# yum install python34-pip

[root@iZj6c39y62jl5b1wmfv6u8Z ~]# pip3 install --upgrade pip
Collecting pip
  Downloading http://mirrors.aliyun.com/pypi/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 68.9MB/s 
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
      Successfully uninstalled pip-8.1.2
Successfully installed pip-10.0.1
			
			
			
python3.6 -m venv env --without-pip
source env/bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python3
python3.6 -m pip install web3			
			
			

12.1.2. MAC OS

首先去 python.org 官网下载 Python 3.6.5 dmg格式,安装后进入终端。

			
You should consider upgrading via the 'pip install --upgrade pip' command.
neo@MacBook-Pro ~/ethereum/web3.py % pip3.6 install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-10.0.1
			
neo@MacBook-Pro ~/ethereum/web3.py % pip3.6 install web3