概要
pybitflyerを用いたソースをCloud9で動かすときにはまったので備防録
Python3系への変更
Cloud9 で BitMEX のBotをTESTNETで動かす
https://qiita.com/aisurta/items/8990820f48457bf17cf0
で書いたときはCloud9はデフォルトのPythonは2系ですよといったが、現在(2019/11/02)時点では3系がデフォルトになっているため、~/.bashrcを編集する必要はない
requests、pyyaml等のインストール
ただし、pipのインストール先はデフォルトが
/usr/local/lib/python2.7/site-packages
なので単純に
pip install requests
だけだとpythonで呼び出すときに
ModuleNotFoundError: No module named 'requests'
というエラーが出る。そこで以下を入力。
sudo update-alternatives --config python
以下のように表示されるので
There are 2 programs which provide 'python'.
Selection Command
-----------------------------------------------
*+ 1 /usr/bin/python2.7
2 /usr/bin/python3.6
Enter to keep the current selection[+], or type selection number:
2を入力。
あとはsudo pip install ○○で以下をインストールしていく
sudo pip install requests
sudo pip install pyyaml
sudo pip install pandas
sudo pip install websocket-client
sudo pip install sortedcontainers
sudo pip install matplotlib
参考にしたサイト
[Python] pipで任意のディレクトリにライブラリをインストールする
https://hacknote.jp/archives/27694/