how to use tushare

////// run demo

[root@wode005 tushare.hist]# python get.stock.hist.day.py

Traceback (most recent call last):

  File "get.stock.hist.day.py", line 6, in <module>

    import tushare as ts

ImportError: No module named tushare


////// # pip install tushare

[root@wode005 tushare.hist]# pip install tushare

Collecting tushare

  Downloading tushare-0.4.3-py2-none-any.whl (87kB)

    100% |��������������������������������| 90kB 467kB/s

Installing collected packages: tushare

Successfully installed tushare-0.4.3

[root@wode005 tushare.hist]# python get.stock.hist.day.py

Traceback (most recent call last):

  File "get.stock.hist.day.py", line 6, in <module>

    import tushare as ts

  File "/usr/local/lib/python2.7/site-packages/tushare/__init__.py", line 7, in <module>

    from tushare.stock.trading import (get_hist_data, get_tick_data,

  File "/usr/local/lib/python2.7/site-packages/tushare/stock/trading.py", line 13, in <module>

    import lxml.html

ImportError: No module named lxml.html

[root@wode005 tushare.hist]#


////// # pip install lxml

Exception:

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main

    status = self.run(options, args)

  File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 282, in run

    wheel_cache

  File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 272, in populate_requirement_set

    wheel_cache=wheel_cache

  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 213, in from_line

    wheel_cache=wheel_cache, constraint=constraint)

  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 67, in __init__

    req = pkg_resources.Requirement.parse(req)

  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2980, in parse

    reqs = list(parse_requirements(s))

  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2911, in parse_requirements

    raise RequirementParseError("Missing distribution spec", line)

RequirementParseError: Missing distribution spec [root@wode005


////// # pip install lxml

  ERROR: /bin/sh: xslt-config: 未找到命令


  ** make sure the development packages of libxml2 and libxslt are installed **


////// install some packages

# yum install libxml2

# yum install libxslt

# yum install libxml2-devel

# yum install libxslt-devel


////// # pip install lxml

[root@wode005 tushare.hist]# pip install lxml

Collecting lxml

  Using cached lxml-3.5.0.tar.gz

Building wheels for collected packages: lxml

  Running setup.py bdist_wheel for lxml

Successfully built lxml

Installing collected packages: lxml

Successfully installed lxml-3.5.0


////// run demo

[root@wode005 tushare.hist]# python get.stock.hist.day.py

Traceback (most recent call last):

  File "get.stock.hist.day.py", line 6, in <module>

    import tushare as ts

  File "/usr/local/lib/python2.7/site-packages/tushare/__init__.py", line 7, in <module>

    from tushare.stock.trading import (get_hist_data, get_tick_data,

  File "/usr/local/lib/python2.7/site-packages/tushare/stock/trading.py", line 15, in <module>

    import pandas as pd

ImportError: No module named pandas


////// # pip install pandas

Successfully built pandas numpy

Installing collected packages: six, python-dateutil, pytz, numpy, pandas

Successfully installed numpy-1.10.2 pandas-0.17.1 python-dateutil-2.4.2 pytz-2015.7 six-1.10.0


你可能感兴趣的:(tushare)