2
1

More than 3 years have passed since last update.

pybitflyerを使うBotを、Cloud9で動作させる

Last updated at Posted at 2019-11-02

概要

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/

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1