在 windows 7 中安装 talib 失败

Failing on install talib in windows 7

我正在尝试在 Windows 中安装 TALib,但出现此错误:

   common.obj : error LNK2019: unresolved external symbol TA_GetUnstablePeriod referenced in function __pyx_pf_5talib_6common_8_ta_get_unstable_period
    build\lib.win-amd64-2.7\talib\common.pyd : fatal error LNK1120: 5 unresolved externals
    error: command 'C:\Users\felipe.ferminiano\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe' failed with exit status 1120

    ----------------------------------------
Command "C:\ProgramData\Anaconda2\python.exe -u -c 
    "import setuptools, tokenize;
        __file__='c:\users\felipe~1.fer\appdata\local\temp\pip-build-kye3ah\TA-Lib\setup.py';
        f=getattr(tokenize, 'open', open)(__file__);
        code=f.read().replace('\r\n', '\n');
        f.close();
        exec(compile(code, __file__, 'exec'))"
    install --record c:\users\felipe~1.fer\appdata\local\temp\pip-al6w47-record\install-record.txt --single-version-externally-managed --compile"
failed with error code 1 in c:\users\felipe~1.fer\appdata\local\temp\pip-build-kye3ah\TA-Lib\

当我 运行:

pip install TA-Lib

我已经为 Python 2.7 安装了 Microsoft Visual C++ 编译器。 我该如何解决这个问题?

存储库的 README 中提到了该错误:GitHub Repo

Sometimes installation will produce build errors like this:

func.c:256:28: fatal error: ta-lib/ta_libc.h: No such file or directory
compilation terminated.

This typically means that it can't find the underlying TA-Lib library, a dependency which needs to be installed. On Windows, this could be caused by installing the 32-bit binary distribution of the underlying TA-Lib library, but trying to use it with 64-bit Python.

由于您的错误日志包含 amd64,32 位与 64 位问题很可能是您的实际问题。

该库仅以 32 位格式分发(compilation/linking 日期为 2007 年)

检查问题 #11,GitHub - Issue #11 以获取有关如何自行编译它的提示。

我遇到了同样的问题 运行 Anaconda3/python3.5/JupiterNotebook: 检查您的版本并从以下位置下载适当的二进制文件:https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib

上传并安装:

!pip 安装 TA_Lib-0.4.17-cp35-cp35m-win_amd64.whl

Ta-Lib 安装要求您安装二进制依赖项。这可以通过安装 whl 文件轻松安装。该文件可以在 link 中找到:https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib. You can refer to this blog for detailed steps: https://blog.quantinsti.com/install-ta-lib-python/

我在 ta-lib 和其他包之间进行了并行 运行,并且还使用了 jit 编译器。但是 ta-lib 的结果要好得多。在网上,你会找到很多解决方案,但通过 whl 安装是最好的方法。

希望对您有所帮助。

以下步骤解决了我的问题:

  1. 步骤 1。转到以下 URL 并下载 Windows 或 Mac 的 .whl 文件:https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib
  2. 第 2 步。转到 Anaconda 命令提示符并键入以下内容: C:\Users\UserName> pip install TA_Lib-0.4.21-cp37-cp37m-win_amd64.whl
  3. 步骤 3。如果您没有收到任何错误消息,那么 TA-Lib 将成功安装。

注意:您必须使用以下代码检查现有 python 版本,然后在第 1 步中选择合适的文件:

import platform
print(platform.python_version())

只需下载 .whl 文件,然后将其保存在您的 python 库文件中并 pip 安装 TA_Lib-0.4.24-cp38-cp38-win_amd64.whl,然后尝试手动删除任何与 talib

相关的文件