ubuntu环境下使用Python SDK 与Fisco Bcos交互
环境依赖
sudo apt install -y zlib1g-dev libffi6 libffi-dev wget git
出现错误:“E:无法定位软件包”
解决方式:在etc/apt/sourcrs.list 文件后面添加deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
然后:sudo apt-get update
sudo apt-get upgrade
ubuntu 下自带的python3.8
拉取源代码
git clone https://github.com/FISCO-BCOS/python-sdk
进入python SDK文件夹
安装依赖
没有pip命令则:
按提示安装(记不清楚了):sudo apt install python3-pip
直接使用清华源:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
中间出错多试几次
初始化配置
将client_config.py.template拷贝为client_config.py
cat client_config.py.template >> client_config.py
下载solc编译器
bash init_env.sh -i (中间卡顿或者失败多试几次)
配置证书
(按照官方的原始配置,channel 的配置基本一样)
cp ~/fisco/nodes/127.0.0.1/sdk/* bin/
查看版本
进入Python-sdk 文件夹,执行:
python3 ./console.py getNodeVersion
INFO >> user input : ['getNodeVersion'] INFO : getNodeVersion : { "Build Time": "20200619 06:32:10", "Build Type": "Linux/clang/Release", "Chain Id": "1", "FISCO-BCOS Version": "2.5.0", "Git Branch": "HEAD", "Git Commit Hash": "72c6d770e5cf0f4197162d0e26005ec03d30fcfe", "Supported Version": "2.5.0" }
----------------------------------------声明----------------------------------------
----------------------------------------end----------------------------------------