报错信息如下:

>>> import tushare as ts
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/oracle/anaconda3/lib/python3.8/site-packages/tushare/__init__.py", line 11, in <module>
    from tushare.stock.trading import (get_hist_data, get_tick_data,
  File "/home/oracle/anaconda3/lib/python3.8/site-packages/tushare/stock/trading.py", line 15, in <module>
    import pandas as pd
  File "/home/oracle/anaconda3/lib/python3.8/site-packages/pandas/__init__.py", line 26, in <module>
    from pandas._libs import (hashtable as _hashtable,
  File "/home/oracle/anaconda3/lib/python3.8/site-packages/pandas/_libs/__init__.py", line 4, in <module>
    from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
  File "__init__.pxd", line 872, in init pandas._libs.tslib
ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216

原因是numpy的版本与和scikit-learn版本不匹配

解决办法,升级numpy

pip install -u numpy
(base) [oracle@kiwi python]$ python
Python 3.8.3 (default, Jul  2 2020, 16:21:59) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tushare
Logo

加入社区!打开量化的大门,首批课程上线啦!

更多推荐