Downloading https://files.pythonhosted.org/packages/79/44/9d25944c500732f10cde648b86be297449eb3d2c9608699f744e75d9361f/twder-0.1.4-py3-none-any.whl
Using cached https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl
Using cached https://files.pythonhosted.org/packages/7d/29/174d70f303016c58bd790c6c86e6e86a9d18239fac314d55a9b7be501943/lxml-4.3.3.tar.gz
Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Using cached https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl
Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Using cached https://files.pythonhosted.org/packages/60/75/f692a584e85b7eaba0e03827b3d51f45f571c2e793dd731e598828d380aa/certifi-2019.3.9-py2.py3-none-any.whl
Running setup.py bdist_wheel for lxml ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-x2ow03f4/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpijs4zby1pip-wheel- --python-tag cp35:
Building lxml version 4.3.3.
.... (略) ....
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-6waWnr/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/usr/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv7l-3.5/src/lxml/etree.o -w
compilation terminated.
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInit3sx4_qt3.c -o tmp/xmlXPathInit3sx4_qt3.o
compilation terminated.
*********************************************************************************
*********************************************************************************
Installing collected packages: idna, urllib3, chardet, certifi, requests, lxml, twder
Running setup.py install for lxml ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-x2ow03f4/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-jxkmwzj0-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
Building lxml version 4.3.3.
.... (略) ....
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-6waWnr/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/usr/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv7l-3.5/src/lxml/etree.o -w
compilation terminated.
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitzd492hbe.c -o tmp/xmlXPathInitzd492hbe.o
compilation terminated.
*********************************************************************************
*********************************************************************************
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-x2ow03f4/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-jxkmwzj0-record/install-record.txt --single-version-externally-managed --compile --user --prefix="
總之就是缺了 libxml2 與 libxslt 這兩個相依模組.
Could not find a version that satisfies the requirement libxml2 (from versions: )
安裝過程跑很久, 會讓人誤以為是當機了, 但只要耐心等待, 最後會顯示成功訊息. 其實還有一個做法是, 乾脆在 PyPi 網站下載原始程式來編譯會比較快 (注意, libxml2 與 libxslt 還是要先安裝, 再編譯 twder 原始碼) :
pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import twder #匯入套件
>>> twder.currencies() #列出台銀可交易之外幣代號
['MYR', 'JPY', 'GBP', 'NZD', 'VND', 'ZAR', 'HKD', 'USD', 'CHF', 'KRW', 'SGD', 'IDR', 'CNY', 'CAD', 'AUD', 'EUR', 'SEK', 'THB', 'PHP']
>>> twder.currency_name_dict() #列出台銀可交易之外幣代號
{'MYR': '馬來幣 (MYR)', 'JPY': '日圓 (JPY)', 'GBP': '英鎊 (GBP)', 'NZD': '紐元 (NZD)', 'VND': '越南盾 (VND)', 'ZAR': '南非幣 (ZAR)', 'HKD': '港幣 (HKD)', 'USD': '美金 (USD)', 'CHF': '瑞士法郎 (CHF)', 'KRW': '韓元 (KRW)', 'SGD': '新加坡幣 (SGD)', 'IDR': '印尼幣 (IDR)', 'CNY': '人民幣 (CNY)', 'CAD': '加拿大幣 (CAD)', 'AUD': '澳幣 (AUD)', 'EUR': '歐元 (EUR)', 'SEK': '瑞典幣 (SEK)', 'THB': '泰幣 (THB)', 'PHP': '菲國比索 (PHP)'}
>>> twder.now('USD') #查詢指定貨幣即時報價
('2019/04/08 16:00', '30.41', '31.1', '30.78', '30.88')
>>> twder.now_all() #查詢全部貨幣即時報價
{'MYR': ('2019/04/08 16:00', '6.426', '8.056', '-', '-'), 'JPY': ('2019/04/08 16:00', '0.2674', '0.2802', '0.2747', '0.2787'), 'GBP': ('2019/04/08 16:00', '39.06', '41.18', '40.06', '40.48'), 'SGD': ('2019/04/08 16:00', '22.16', '23.07', '22.65', '22.83'), 'IDR': ('2019/04/08 16:00', '0.00183', '0.00253', '-', '-'), 'NZD': ('2019/04/08 16:00', '20.29', '21.14', '20.67', '20.87'), 'CAD': ('2019/04/08 16:00', '22.55', '23.46', '22.94', '23.16'), 'KRW': ('2019/04/08 16:00', '0.02517', '0.02907', '-', '-'), 'ZAR': ('2019/04/08 16:00', '-', '-', '2.13', '2.21'), 'AUD': ('2019/04/08 16:00', '21.51', '22.29', '21.78', '22.01'), 'THB': ('2019/04/08 16:00', '0.8413', '1.0293', '0.9499', '0.9899'), 'CNY': ('2019/04/08 16:00', '4.489', '4.651', '4.561', '4.611'), 'HKD': ('2019/04/08 16:00', '3.761', '3.977', '3.897', '3.957'), 'EUR': ('2019/04/08 16:00', '33.8', '35.14', '34.42', '34.82'), 'PHP': ('2019/04/08 16:00', '0.5178', '0.6508', '-', '-'), 'USD': ('2019/04/08 16:00', '30.41', '31.1', '30.78', '30.88'), 'VND': ('2019/04/08 16:00', '0.00096', '0.00146', '-', '-'), 'CHF': ('2019/04/08 16:00', '30.03', '31.23', '30.69', '30.98'), 'SEK': ('2019/04/08 16:00', '2.93', '3.45', '3.27', '3.37')}
>>> twder.past_day('USD') #查詢指定貨幣昨日全部報價
[('2019/04/08 09:00:50', '30.395', '31.085', '30.765', '30.865'), ('2019/04/08 09:05:23', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 09:14:08', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 09:25:06', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 09:34:23', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 09:35:29', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 09:41:51', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 09:47:12', '30.395', '31.085', '30.765', '30.865'), ('2019/04/08 09:57:28', '30.395', '31.085', '30.765', '30.865'), ('2019/04/08 10:00:25', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 10:02:58', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 10:10:48', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 10:15:11', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 10:16:55', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 10:18:39', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 10:23:17', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 10:25:13', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 10:32:03', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 10:32:37', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 10:35:07', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 10:54:25', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 10:55:51', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 11:03:38', '30.395', '31.085', '30.765', '30.865'), ('2019/04/08 11:10:30', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 11:14:39', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 11:20:59', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 11:26:03', '30.395', '31.085', '30.765', '30.865'), ('2019/04/08 11:27:28', '30.395', '31.085', '30.765', '30.865'), ('2019/04/08 11:32:35', '30.395', '31.085', '30.765', '30.865'), ('2019/04/08 11:35:21', '30.395', '31.085', '30.765', '30.865'), ('2019/04/08 11:45:02', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 11:57:11', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 12:21:05', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 12:39:39', '30.4', '31.09', '30.77', '30.87'), ('2019/04/08 12:46:18', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 12:58:35', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 13:14:20', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 13:43:19', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 13:59:57', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 14:00:42', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 14:23:52', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 14:25:16', '30.41', '31.1', '30.78', '30.88'), ('2019/04/08 14:33:11', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 15:03:18', '30.405', '31.095', '30.775', '30.875'), ('2019/04/08 15:12:05', '30.41', '31.1', '30.78', '30.88'), ('2019/04/08 15:32:12', '30.41', '31.1', '30.78', '30.88'), ('2019/04/08 15:39:11', '30.41', '31.1', '30.78', '30.88'), ('2019/04/08 15:42:54', '30.415', '31.105', '30.785', '30.885'), ('2019/04/08 16:00:10', '30.41', '31.1', '30.78', '30.88')]
>>> twder.past_six_month('USD') #查詢指定貨幣近半年收盤價
[('2019/04/08', '30.41', '31.1', '30.78', '30.88'), ('2019/04/03', '30.39', '31.08', '30.76', '30.86'), ('2019/04/02', '30.415', '31.105', '30.785', '30.885'), ('2019/04/01', '30.375', '31.065', '30.745', '30.845'), ('2019/03/29', '30.4', '31.09', '30.77', '30.87'), ('2019/03/28', '30.425', '31.115', '30.795', '30.895'), ('2019/03/27', '30.43', '31.12', '30.8', '30.9'), ('2019/03/26', '30.41', '31.1', '30.78', '30.88'), ('2019/03/25', '30.4', '31.09', '30.77', '30.87'), ('2019/03/22', '30.375', '31.065', '30.745', '30.845'), ('2019/03/21', '30.39', '31.08', '30.76', '30.86'), ('2019/03/20', '30.41', '31.1', '30.78', '30.88'), ('2019/03/19', '30.41', '31.1', '30.78', '30.88'), ('2019/03/18', '30.41', '31.1', '30.78', '30.88'), ('2019/03/15', '30.455', '31.145', '30.825', '30.925'), ('2019/03/14', '30.47', '31.16', '30.84', '30.94'), ('2019/03/13', '30.48', '31.17', '30.85', '30.95'), ('2019/03/12', '30.48', '31.17', '30.85', '30.95'), ('2019/03/11', '30.48', '31.17', '30.85', '30.95'), ('2019/03/08', '30.475', '31.165', '30.845', '30.945'), ('2019/03/07', '30.445', '31.135', '30.815', '30.915'), ('2019/03/06', '30.425', '31.115', '30.795', '30.895'), ('2019/03/05', '30.42', '31.11', '30.79', '30.89'), ('2019/03/04', '30.4', '31.09', '30.77', '30.87'), ('2019/02/27', '30.35', '31.04', '30.72', '30.82'), ('2019/02/26', '30.36', '31.05', '30.73', '30.83'), ('2019/02/25', '30.37', '31.06', '30.74', '30.84'), ('2019/02/23', '30.4', '31.09', '30.77', '30.87'), ('2019/02/22', '30.4', '31.09', '30.77', '30.87'), ('2019/02/21', '30.405', '31.095', '30.775', '30.875'), ('2019/02/20', '30.405', '31.095', '30.775', '30.875'), ('2019/02/19', '30.415', '31.105', '30.785', '30.885'), ('2019/02/18', '30.42', '31.11', '30.79', '30.89'), ('2019/02/15', '30.43', '31.12', '30.8', '30.9'), ('2019/02/14', '30.41', '31.1', '30.78', '30.88'), ('2019/02/13', '30.41', '31.1', '30.78', '30.88'), ('2019/02/12', '30.41', '31.1', '30.78', '30.88'), ('2019/02/11', '30.38', '31.07', '30.75', '30.85'), ('2019/02/01', '30.315', '31.005', '30.685', '30.785'), ('2019/01/31', '30.315', '31.005', '30.685', '30.785'), ('2019/01/30', '30.34', '31.03', '30.71', '30.81'), ('2019/01/29', '30.39', '31.08', '30.76', '30.86'), ('2019/01/28', '30.37', '31.06', '30.74', '30.84'), ('2019/01/25', '30.4', '31.09', '30.77', '30.87'), ('2019/01/24', '30.46', '31.15', '30.83', '30.93'), ('2019/01/23', '30.47', '31.16', '30.84', '30.94'), ('2019/01/22', '30.47', '31.16', '30.84', '30.94'), ('2019/01/21', '30.425', '31.115', '30.795', '30.895'), ('2019/01/19', '30.415', '31.105', '30.785', '30.885'), ('2019/01/18', '30.42', '31.11', '30.79', '30.89'), ('2019/01/17', '30.425', '31.115', '30.795', '30.895'), ('2019/01/16', '30.405', '31.095', '30.775', '30.875'), ('2019/01/15', '30.395', '31.085', '30.765', '30.865'), ('2019/01/14', '30.42', '31.11', '30.79', '30.89'), ('2019/01/11', '30.375', '31.065', '30.745', '30.845'), ('2019/01/10', '30.36', '31.05', '30.73', '30.83'), ('2019/01/09', '30.375', '31.065', '30.745', '30.845'), ('2019/01/08', '30.415', '31.105', '30.785', '30.885'), ('2019/01/07', '30.385', '31.075', '30.755', '30.855'), ('2019/01/04', '30.435', '31.125', '30.805', '30.905'), ('2019/01/03', '30.455', '31.145', '30.825', '30.925'), ('2019/01/02', '30.365', '31.055', '30.735', '30.835'), ('2018/12/28', '30.295', '30.985', '30.665', '30.765'), ('2018/12/27', '30.37', '31.06', '30.74', '30.84'), ('2018/12/26', '30.39', '31.08', '30.76', '30.86'), ('2018/12/25', '30.38', '31.07', '30.75', '30.85'), ('2018/12/24', '30.41', '31.1', '30.78', '30.88'), ('2018/12/22', '30.4', '31.09', '30.77', '30.87'), ('2018/12/21', '30.375', '31.065', '30.745', '30.845'), ('2018/12/20', '30.41', '31.1', '30.78', '30.88'), ('2018/12/19', '30.385', '31.075', '30.755', '30.855'), ('2018/12/18', '30.44', '31.13', '30.81', '30.91'), ('2018/12/17', '30.445', '31.135', '30.815', '30.915'), ('2018/12/14', '30.435', '31.125', '30.805', '30.905'), ('2018/12/13', '30.42', '31.11', '30.79', '30.89'), ('2018/12/12', '30.445', '31.135', '30.815', '30.915'), ('2018/12/11', '30.47', '31.16', '30.84', '30.94'), ('2018/12/10', '30.445', '31.135', '30.815', '30.915'), ('2018/12/07', '30.41', '31.1', '30.78', '30.88'), ('2018/12/06', '30.42', '31.11', '30.79', '30.89'), ('2018/12/05', '30.38', '31.07', '30.75', '30.85'), ('2018/12/04', '30.28', '30.97', '30.65', '30.75'), ('2018/12/03', '30.31', '31', '30.68', '30.78'), ('2018/11/30', '30.41', '31.1', '30.78', '30.88'), ('2018/11/29', '30.41', '31.1', '30.78', '30.88'), ('2018/11/28', '30.48', '31.17', '30.85', '30.95'), ('2018/11/27', '30.47', '31.16', '30.84', '30.94'), ('2018/11/26', '30.455', '31.145', '30.825', '30.925'), ('2018/11/23', '30.475', '31.165', '30.845', '30.945'), ('2018/11/22', '30.465', '31.155', '30.835', '30.935'), ('2018/11/21', '30.465', '31.155', '30.835', '30.935'), ('2018/11/20', '30.48', '31.17', '30.85', '30.95'), ('2018/11/19', '30.48', '31.17', '30.85', '30.95'), ('2018/11/16', '30.465', '31.155', '30.835', '30.935'), ('2018/11/15', '30.42', '31.11', '30.79', '30.89'), ('2018/11/14', '30.49', '31.18', '30.86', '30.96'), ('2018/11/13', '30.475', '31.165', '30.845', '30.945'), ('2018/11/12', '30.46', '31.15', '30.83', '30.93'), ('2018/11/09', '30.38', '31.07', '30.75', '30.85'), ('2018/11/08', '30.275', '30.965', '30.645', '30.745'), ('2018/11/07', '30.33', '31.02', '30.7', '30.8'), ('2018/11/06', '30.35', '31.04', '30.72', '30.82'), ('2018/11/05', '30.335', '31.025', '30.705', '30.805'), ('2018/11/02', '30.3', '30.99', '30.67', '30.77'), ('2018/11/01', '30.495', '31.185', '30.865', '30.965'), ('2018/10/31', '30.535', '31.225', '30.905', '31.005'), ('2018/10/30', '30.555', '31.245', '30.925', '31.025'), ('2018/10/29', '30.57', '31.26', '30.94', '31.04'), ('2018/10/26', '30.575', '31.265', '30.945', '31.045'), ('2018/10/25', '30.565', '31.255', '30.935', '31.035'), ('2018/10/24', '30.52', '31.21', '30.89', '30.99'), ('2018/10/23', '30.54', '31.23', '30.91', '31.01'), ('2018/10/22', '30.495', '31.185', '30.865', '30.965'), ('2018/10/19', '30.53', '31.22', '30.9', '31'), ('2018/10/18', '30.53', '31.22', '30.9', '31'), ('2018/10/17', '30.41', '31.1', '30.78', '30.88'), ('2018/10/16', '30.485', '31.175', '30.855', '30.955'), ('2018/10/15', '30.5', '31.19', '30.87', '30.97'), ('2018/10/12', '30.44', '31.13', '30.81', '30.91'), ('2018/10/11', '30.68', '31.37', '31.05', '31.15')]
>>> twder.specify_month('USD', 2018, 10) #查詢指定月份收盤價
[('2018/10/31', '30.535', '31.225', '30.905', '31.005'), ('2018/10/30', '30.555', '31.245', '30.925', '31.025'), ('2018/10/29', '30.57', '31.26', '30.94', '31.04'), ('2018/10/26', '30.575', '31.265', '30.945', '31.045'), ('2018/10/25', '30.565', '31.255', '30.935', '31.035'), ('2018/10/24', '30.52', '31.21', '30.89', '30.99'), ('2018/10/23', '30.54', '31.23', '30.91', '31.01'), ('2018/10/22', '30.495', '31.185', '30.865', '30.965'), ('2018/10/19', '30.53', '31.22', '30.9', '31'), ('2018/10/18', '30.53', '31.22', '30.9', '31'), ('2018/10/17', '30.41', '31.1', '30.78', '30.88'), ('2018/10/16', '30.485', '31.175', '30.855', '30.955'), ('2018/10/15', '30.5', '31.19', '30.87', '30.97'), ('2018/10/12', '30.44', '31.13', '30.81', '30.91'), ('2018/10/11', '30.68', '31.37', '31.05', '31.15'), ('2018/10/09', '30.54', '31.23', '30.91', '31.01'), ('2018/10/08', '30.505', '31.195', '30.875', '30.975'), ('2018/10/05', '30.405', '31.095', '30.775', '30.875'), ('2018/10/04', '30.36', '31.05', '30.73', '30.83'), ('2018/10/03', '30.24', '30.93', '30.61', '30.71'), ('2018/10/02', '30.245', '30.935', '30.615', '30.715'), ('2018/10/01', '30.11', '30.8', '30.48', '30.58')]