MMoSP001- Anaconda 安装 steem-python 开发环境

in #esteem5 years ago

steem-python :是 Steem 官方的 Python 库,有一个BIP38加密钱包和一个实用的CLI实用程序 steempy。

steem-python 需要 Python 3.5 以上的版本,这里通过Anaconda 来安装,提供跨平台管理 python开发环境, 这可以让windows开发者和linux/MacOS开发者一样,尽心类似的开发操作.

MacOS10.14 安装 Anaconda3-2019.10 版本

官方安装地址:https://repo.anaconda.com/archive/Anaconda3-2019.10-MacOSX-x86_64.sh
如果官方下载慢,可用清华大学镜像:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2019.10-MacOSX-x86_64.sh

$ cd ~
$ wget https://repo.anaconda.com/archive/Anaconda3-2019.10-MacOSX-x86_64.sh
$ bash Anaconda3-2019.10-MacOSX-x86_64.sh
$ source ~/.bash_profile
(base) ~$ python -V
(base) ~$ pip -V

ubuntu18.04 安装 Anaconda3-2019.10 版本

官方安装地址:https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
如果官方下载慢,可用清华大学镜像:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2019.10-Linux-x86_64.sh

$ cd ~
$ sudo apt-get remove python3 python3-dev python3-pip
$ sudo apt-get install libffi-dev libssl-dev make
$ wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
$ sh ./Anaconda3-2019.10-Linux-x86_64.sh
$ source ~/.bashrc
(base) ~$ python -V
(base) ~$ pip -V 

Anaconda3 安装 steem-python

Anaconda3 默认安装方式,会在用户登录后,自动进入 Anaconda3 的 python开发环境.
如果没有默认Anaconda3环境,可以手工方式进入Anaconda3环境:(base) ~$ conda activate
退出Anaconda3环境:(base) ~$ conda deactivate

$ cd ~
$ conda activate
(base) ~$ conda config --add channels conda-forge
(base) ~$ conda install cryptography
(base) ~$ git clone https://github.com/steemit/steem-python
(base) ~$ cd steem-python
(base) ~$ make install

备注:包安装(pip install steem)容易出错.

使用命令行工具 steempy

帮助:steempy --help
设API节点:(base) ~$ steempy set nodes https://anyx.io,https://api.steemit.com
创建钱包密码:$ steempy changewalletpassphrase
添加steem账号:$ steempy addkey
查询本地钱包账号:$ steempy listaccounts

+-----------+---------+-----------------------------------+
| Name | Type | Available Key |
+-----------+---------+-----------------------------------+
| ddxxxxnk | active | STMxxxxxx9yyE |
| ddnbbbbnk | posting | STM87YzixbssssEyyfU |
+-----------+---------+-----------------------------------+

设本地钱包默认账号:$ steempy set default_account testdappcoder
设默认投票比重:$ steempy set default_vote_weight 88
查本地钱包设置:$ steempy config

----------------------------------------------+
| Key | Value |
+---------------------+-------------------------+
| nodes | https://anyx.io,https://api.steemit.com |
| default_account | testdappcoder |
| default_vote_weight | 88 |
+---------------------+-------------------+

示范一个扫描最新投票数据的机器人(print_live_votes.py):

from steem.blockchain import Blockchain
from steem.post import Post

blockchain = Blockchain()
stream = map(Post, blockchain.stream(filter_by=['vote']))
for vote in stream:
    print('vote:',vote)

执行程序:python print_live_votes.py
执行结果,和预期一致:
bfibnr.png

#cn #hive-180932 #chinese #hive-143316

English list:

MMoSP000-< make money on steem-python > Preface

中文列表

MMoSP000-《steem-python赚钱实战教程》序言

Sort:  

你好鸭,dappcoder!

@mana.bank给您叫了一份外卖!

@jjprac jjprac 迎着大雪 骑着三轮车 给您送来
珍珠奶茶

吃饱了吗?跟我猜拳吧! 石头,剪刀,布~

如果您对我的服务满意,请不要吝啬您的点赞~
@onepagex


You win!!!! 你赢了!我这新手村猜拳小能手的名号让给你了! 给你1枚SHOP币!

Congratulations @dappcoder! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 50 comments. Your next target is to reach 100 comments.
You got more than 50 replies. Your next target is to reach 100 replies.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

SteemitBoard Ranking update - A better rich list comparator
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.16
TRX 0.17
JST 0.029
BTC 69681.50
ETH 2514.53
USDT 1.00
SBD 2.55