解决方案大全ImportError: libta_lib.so.0: cannot open shared object file: No such file or directory

原始问题:

>>> import talib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/anaconda3/envs/vnpy27/lib/python2.7/site-packages/talib/__init__.py", line 4, in <module>
    from . import common
ImportError: libta_lib.so.0: cannot open shared object file: No such file or directory

附录:官方的安装方法

pip install TA-Lib
参考:https://github.com/mrjbq7/ta-lib

方案01,export

参考:https://github.com/mrjbq7/ta-lib/issues/6

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH  

等价做法:
$ LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" python
>>> import talib

方案02,源代码安装

参考:https://stackoverflow.com/questions/45406361/importerror-libta-lib-so-0-cannot-open-shared-object-file-no-such-file-or-dir
https://ideaorchard.wordpress.com/2015/01/16/installing-ta-lib-ubuntu/

I had the same issue. See below for what I did to fix it.

installing

wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr
make
Sudo make install
pip install numpy
If you don't have it installed

pip install TA-Lib 
if you do have it installed

pip install --upgrade --force-reinstall TA-Lib

方案3,conda安装(这个一般比较好使)

sudo chmod -R 777 anaconda3
conda install -chttps://conda.anaconda.org/quantopian ta-lib
发布了232 篇原创文章 · 获赞 127 · 访问量 69万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览