Python TA-Lib 安装问题

2022-01-15 00:00:00 python pip windows-10 installation ta-lib

问题描述

在 python 中安装 TA-Lib 包非常困难,令人沮丧.

Frustratingly having a lot of difficult installing the TA-Lib package in python.

https://pypi.python.org/pypi/TA-Lib

我已经阅读了所有可以找到的论坛帖子,但对于我的特定问题没有这样的运气..

I have read through all the forum posts I can find on this but no such luck for my particular problem..

Windows 10Python 3.5.2蟒蛇 4.2.0赛通 0.24.1微软 Visual Studio 14.0

Windows 10 Python 3.5.2 Anaconda 4.2.0 Cython 0.24.1 Microsoft Visual Studio 14.0

我已下载 ta-lib-0.4.0-msvc.zip 并将其解压缩到 C:/TA-Lib(常见问题似乎是人们没有安装底层 TA-Lib 文件 http://www.ta-lib.org/hdr_dw.html)

I have downloaded and extracted  ta-lib-0.4.0-msvc.zip to C:/TA-Lib (common problems seem to be people not installing the underlying TA-Lib file http://www.ta-lib.org/hdr_dw.html)

如果有人能帮我解决这个问题,我将不胜感激!

If someone could help me solve this I would be very appreciative!

使用 'pip install ta-lib' 我得到以下信息:

Using 'pip install ta-lib' I get the following:

C:UsersMatt>pip install ta-lib
Collecting ta-lib
  Using cached TA-Lib-0.4.10.tar.gz
Building wheels for collected packages: ta-lib
  Running setup.py bdist_wheel for ta-lib ... error
  Complete output from command c:usersmattanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\Matt\AppData\Local\Temp\pip-build-vv02ktg_\ta-lib\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('
', '
');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:UsersMattAppDataLocalTemp	mpqstzmsgspip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating buildlib.win-amd64-3.5
  creating buildlib.win-amd64-3.5	alib
  copying talibdeprecated.py -> buildlib.win-amd64-3.5	alib
  copying talib	est_abstract.py -> buildlib.win-amd64-3.5	alib
  copying talib	est_data.py -> buildlib.win-amd64-3.5	alib
  copying talib	est_func.py -> buildlib.win-amd64-3.5	alib
  copying talib	est_stream.py -> buildlib.win-amd64-3.5	alib
  copying talib\__init__.py -> buildlib.win-amd64-3.5	alib
  running build_ext
  skipping 'talibcommon.c' Cython extension (up-to-date)
  building 'talib.common' extension
  creating build	emp.win-amd64-3.5
  creating build	emp.win-amd64-3.5Release
  creating build	emp.win-amd64-3.5Release	alib
  C:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:usersmattanaconda3libsite-packages
umpycoreinclude -Ic:	a-libcinclude -Ic:usersmattanaconda3include -Ic:usersmattanaconda3include "-IC:Program Files (x86)Microsoft Visual Studio 14.0VCINCLUDE" "-IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt" "-IC:Program Files (x86)Windows Kits8.1includeshared" "-IC:Program Files (x86)Windows Kits8.1includeum" "-IC:Program Files (x86)Windows Kits8.1includewinrt" /Tctalibcommon.c /Fobuild	emp.win-amd64-3.5Release	alibcommon.obj
  common.c
  C:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:	a-libclib /LIBPATH:c:usersmattanaconda3libs /LIBPATH:c:usersmattanaconda3PCbuildamd64 "/LIBPATH:C:Program Files (x86)Microsoft Visual Studio 14.0VCLIBamd64" "/LIBPATH:C:Program Files (x86)Windows Kits10lib10.0.10240.0ucrtx64" "/LIBPATH:C:Program Files (x86)Windows Kits8.1libwinv6.3umx64" ta_libc_cdr.lib /EXPORT:PyInit_common build	emp.win-amd64-3.5Release	alibcommon.obj /OUT:buildlib.win-amd64-3.5	alibcommon.cp35-win_amd64.pyd /IMPLIB:build	emp.win-amd64-3.5Release	alibcommon.cp35-win_amd64.lib
  common.obj : warning LNK4197: export 'PyInit_common' specified multiple times; using first specification
     Creating library build	emp.win-amd64-3.5Release	alibcommon.cp35-win_amd64.lib and object build	emp.win-amd64-3.5Release	alibcommon.cp35-win_amd64.exp
  common.obj : error LNK2001: unresolved external symbol TA_SetUnstablePeriod
  common.obj : error LNK2001: unresolved external symbol TA_Shutdown
  common.obj : error LNK2001: unresolved external symbol TA_Initialize
  common.obj : error LNK2001: unresolved external symbol TA_GetUnstablePeriod
  common.obj : error LNK2001: unresolved external symbol TA_GetVersionString
  buildlib.win-amd64-3.5	alibcommon.cp35-win_amd64.pyd : fatal error LNK1120: 5 unresolved externals
  error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe' failed with exit status 1120

  ----------------------------------------
  Failed building wheel for ta-lib
  Running setup.py clean for ta-lib
Failed to build ta-lib
Installing collected packages: ta-lib
  Running setup.py install for ta-lib ... error
    Complete output from command c:usersmattanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\Matt\AppData\Local\Temp\pip-build-vv02ktg_\ta-lib\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('
', '
');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersMattAppDataLocalTemppip-qxmjmn5m-recordinstall-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating buildlib.win-amd64-3.5
    creating buildlib.win-amd64-3.5	alib
    copying talibdeprecated.py -> buildlib.win-amd64-3.5	alib
    copying talib	est_abstract.py -> buildlib.win-amd64-3.5	alib
    copying talib	est_data.py -> buildlib.win-amd64-3.5	alib
    copying talib	est_func.py -> buildlib.win-amd64-3.5	alib
    copying talib	est_stream.py -> buildlib.win-amd64-3.5	alib
    copying talib\__init__.py -> buildlib.win-amd64-3.5	alib
    running build_ext
    skipping 'talibcommon.c' Cython extension (up-to-date)
    building 'talib.common' extension
    creating build	emp.win-amd64-3.5
    creating build	emp.win-amd64-3.5Release
    creating build	emp.win-amd64-3.5Release	alib
    C:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:usersmattanaconda3libsite-packages
umpycoreinclude -Ic:	a-libcinclude -Ic:usersmattanaconda3include -Ic:usersmattanaconda3include "-IC:Program Files (x86)Microsoft Visual Studio 14.0VCINCLUDE" "-IC:Program Files (x86)Windows Kits10include10.0.10240.0ucrt" "-IC:Program Files (x86)Windows Kits8.1includeshared" "-IC:Program Files (x86)Windows Kits8.1includeum" "-IC:Program Files (x86)Windows Kits8.1includewinrt" /Tctalibcommon.c /Fobuild	emp.win-amd64-3.5Release	alibcommon.obj
    common.c
    C:Program Files (x86)Microsoft Visual Studio 14.0VCBINx86_amd64link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:	a-libclib /LIBPATH:c:usersmattanaconda3libs /LIBPATH:c:usersmattanaconda3PCbuildamd64 "/LIBPATH:C:Program Files (x86)Microsoft Visual Studio 14.0VCLIBamd64" "/LIBPATH:C:Program Files (x86)Windows Kits10lib10.0.10240.0ucrtx64" "/LIBPATH:C:Program Files (x86)Windows Kits8.1libwinv6.3umx64" ta_libc_cdr.lib /EXPORT:PyInit_common build	emp.win-amd64-3.5Release	alibcommon.obj /OUT:buildlib.win-amd64-3.5	alibcommon.cp35-win_amd64.pyd /IMPLIB:build	emp.win-amd64-3.5Release	alibcommon.cp35-win_amd64.lib
    common.obj : warning LNK4197: export 'PyInit_common' specified multiple times; using first specification
       Creating library build	emp.win-amd64-3.5Release	alibcommon.cp35-win_amd64.lib and object build	emp.win-amd64-3.5Release	alibcommon.cp35-win_amd64.exp
    common.obj : error LNK2001: unresolved external symbol TA_SetUnstablePeriod
    common.obj : error LNK2001: unresolved external symbol TA_Shutdown
    common.obj : error LNK2001: unresolved external symbol TA_Initialize
    common.obj : error LNK2001: unresolved external symbol TA_GetUnstablePeriod
    common.obj : error LNK2001: unresolved external symbol TA_GetVersionString
    buildlib.win-amd64-3.5	alibcommon.cp35-win_amd64.pyd : fatal error LNK1120: 5 unresolved externals
    error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe' failed with exit status 1120

    ----------------------------------------
Command "c:usersmattanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\Matt\AppData\Local\Temp\pip-build-vv02ktg_\ta-lib\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('
', '
');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersMattAppDataLocalTemppip-qxmjmn5m-recordinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersMattAppDataLocalTemppip-build-vv02ktg_	a-lib


解决方案

你可以试试Unofficial Windows Binaries for Python Extension Packages"作者:Christoph Gohlke,加州大学欧文分校荧光动力学实验室."

You could try the "Unofficial Windows Binaries for Python Extension Packages by Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California, Irvine."

http://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib

他根据操作系统和 Python 版本编译了不同的版本.你可能需要 TA_Lib‑0.4.10‑cp35‑cp35m‑win_amd64.whl

He has different versions compiled depending on OS and Python version. You probably need TA_Lib‑0.4.10‑cp35‑cp35m‑win_amd64.whl

祝你好运.

相关文章