How to install TA-lib in google colab?

爷,独闯天下 提交于 2019-12-11 13:40:55

问题


I'm trying to install TA-Lib package in google colab notebook but without success. I tried this guide and also Installing TA-Lib on python x64

I get this error:

import platform
print (platform.architecture())

import sys
print(sys.version)

!pip install C:/ta-lib/TA_Lib-0.4.17-cp36-cp36m-win_amd64.whl

#########
('64bit', '')
3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0]
 Requirement 'C:/ta-lib/TA_Lib-0.4.17-cp36-cp36m-win_amd64.whl' looks like a 
  filename, but the file does not exist
  TA_Lib-0.4.17-cp36-cp36m-win_amd64.whl is not a supported wheel on this 
  platform.

回答1:


Have you tried following instructions from here?

https://github.com/mrjbq7/ta-lib

And change any sudo apt-get to just !apt. Any cd to %cd

Update: try this

!wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
!tar -xzvf ta-lib-0.4.0-src.tar.gz
%cd ta-lib
!./configure --prefix=/usr
!make
!make install
!pip install Ta-Lib
import talib



回答2:


Another way use the %%bash command . Install either TA-Lib or ta-lib and then `import talib' .

!wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
!tar -xvf ta-lib-0.4.0-src.tar.gz
%%bash
cd ta-lib
./configure --prefix=/usr
make
sudo make install
sudo apt upgrade
#!pip install TA-Lib
!pip install ta-lib

import talib as ta

If you are using Ubuntu and Jupyter then this answer is helpful Unable to install TA-Lib on Ubuntu



来源:https://stackoverflow.com/questions/49648391/how-to-install-ta-lib-in-google-colab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!