How to install the Ta-lib library under Python2.7 __python

Source: Internet
Author: User

Recently, a model on stock forecasting, because want to use the method in the Talib library, to extract a variety of financial technology indicators, so this library. But the whole process is twists. It took half a genius to get the job done.

Here to share the installation of the steps, save the people in this pit jump ...

Environment Introduction: PYTHON2.7+WIN10

Installation steps:

1. Perform pip install Ta-lib
If you have not previously installed the VC, or if the compiler tool is not under path, you should encounter this error error:microsoft Visual C + + 9.0 is required. Get it from http://aka.ms/vcpython27
This error message is very friendly, we follow the link to download the installation of the compilation tool just fine

2. Install Microsoft Visual C + + Compiler for Python 2.7, and then continue to perform PIP install Ta-lib
Unfortunately, you should still encounter errors. TALIB/COMMON.C (s): fatal error C1083:cannot open include file: ' ta_libc.h ': No such file or directory
This error is due to the fact that the Python library of Ta-lib needs to first install Ta-lib, which is ta-lib is actually a layer of Python packaging for Ta-lib

3. Download Ta-lib, extract to C:\ta-lib
At this point, we continue to perform PIP install Ta-lib, and it is likely that you will be installed successfully. But if you are a 64-bit system, you may still encounter problems.
Common.obj:error lnk2019:unresolved external symbol ta_initialize referenced in function __pyx_pf_5talib_6common_2_ta_ Initialize
This problem is a bit advanced, it seems that the link is wrong, many people to this do not know how to do, there is no good way online. The reason for this problem is that we downloaded the ta-lib in addition to the header file, there are compiled libraries, but this library is 32-bit system compiled, so we need to recompile it under the 64-bit system. Fortunately, the ta-lib we downloaded contains the source code, and the compilation tool is the Microsoft Visual C + + Compiler for Python 2.7 that was previously installed.

4. Open "Start Menu" "Microsoft Visual C + + Compiler Package for Python 2.7" "Visual C + + 2008 64-bit Command Prompt" and then enter the directory in the console C:\ Ta-lib\c\make\cdr\win32\msvc. Execute NMAKE, and after a while, the new 64-bit library compiles.

5. At this point, perform pip install Ta-lib again. We finally saw that the installation was successful.
If you still fail at this time, then you can only ask Google ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.