admin 發表於 2023-4-6 09:04:59

how to install Ta-lib with python 3.11 in Windows

The only solution that worked for me is this:
Download "ta-lib x64.zip" from github above. Extract zip file to C:\, so it looks like this C:\ta-lib
Download Visual C++ build tools 2022:   https://aka.ms/vs/17/release/vs_buildtools.exe
Install Visual C++ build tools: https://stackoverflow.com/a/54136652/10997732
Install ta-lib: pip install ta-lib

You have to find the correct wheel file for TA-Lib and Python 3.11. I currently am trying to find the same file. 3.10 is the latest I have seen https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib

here’s exactly what installing ta-lib on my x64 computer looks like.

1)Get the library source from https://www.ta-lib.org/hdr_dw.html. Select the msvc version. As of this writing, the latest is 0.4.
2)Unzip the library so that c:\ta-lib has the readme.txt and the c, dotnet, etc directories. pip will look for this later.
3)Get build tools for Visual Studio: https://visualstudio.microsoft.c ... -visual-studio-2017
When launching the installer, select Individual Components and pick VC++2015.3 v14.00(v140) toolset for desktop and Windows Universal CRT SDK. You’ll also need the Windows SDK. I installed the latest Windows 10 SDK, and the Windows 8.1 SDK.
4)Open a fresh command prompt (so that it has the new PATH environment with the build tools in it) and go to c:\ta-lib\c\make\cdr\win32\msvc
5)Execute “nmake”
6)pip install msgpack
7)%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 8.1
8)pip install TA-Lib

從命令列使用 Microsoft C++ 工具組 | Microsoft Learn
vcvarsall 語法
vcvarsall.bat [architecture] [platform_type] [winsdk_version] [-vcvars_ver=vcversion] [spectre_mode]architecture
這個選擇性引數會指定要使用的主機和目標架構。 如果未指定 架構 ,則會使用預設建置環境。 支援的引數如下:
architecture編譯器主機電腦架構組建輸出 (目標) 架構
x86x86 32 位元原生x86、x64x86
x86_amd64 或 x86_x64x64 on x86 (跨平台)x86、x64x64
x86_armARM on x86 (跨平台)x86、x64ARM
x86_arm64ARM64 on x86 (跨平台)x86、x64ARM64
amd64 或 x64x64 64 位元原生x64x64
amd64_x86 或 x64_x86x86 on x64 (跨平台)x64x86
amd64_arm 或 x64_armARM on x64 (跨平台)x64ARM
amd64_arm64 或 x64_arm64ARM64 on x64 (跨平台)x64ARM64

platform_type
這個選擇性引數可讓您指定 store 或 uwp 作為平臺類型。 根據預設,環境會設定為建置桌面或主控台應用程式。winsdk_version
選擇性地指定要使用的 Windows SDK 版本。 根據預設,會使用最新安裝的 Windows SDK。 若要指定 Windows SDK 版本,您可以使用完整的 Windows SDK 號碼,例如 10.0.10240.0 ,或指定 8.1 以使用 Windows 8.1 SDK。vcversion
選擇性地指定要使用的 Visual Studio 編譯器工具組。 根據預設,環境會設定為使用目前的 Visual Studio 編譯器工具組。使用 -vcvars_ver=14.2x.yyyyyyy 來指定 Visual Studio 2019 編譯器工具組的特定版本。使用 -vcvars_ver=14.29 來指定最新版的 Visual Studio 2019 編譯器工具組。
使用 -vcvars_ver=14.0 來指定 Visual Studio 2015 編譯器工具組。spectre_mode
請將此參數保留為不使用 Spectre 風險降低的程式庫。 使用 值 spectre 搭配 Spectre 風險降低使用程式庫。在現有的命令提示字元視窗中設定組建環境

[*]在命令提示字元中,使用 CD 命令切換至 Visual Studio 安裝目錄。 然後,再次使用 CD 變更至包含組態特定指令檔的子目錄。 針對 Visual Studio 2019 和 Visual Studio 2017,請使用 VC\Auxiliary\Build 子目錄。 針對 Visual Studio 2015,請使用 VC 子目錄。
[*]針對您慣用的開發人員環境輸入命令。 例如,若要在 64 位平臺上建置 UWP 的 ARM 程式碼,請使用最新的 Windows SDK 和 Visual Studio 編譯器工具組,請使用下列命令列:vcvarsall.bat amd64_arm uwp
建立您自己的命令提示字元捷徑
開啟開發人員命令提示字元快捷方式的 [屬性] 對話方塊,以查看所使用的命令目標。 例如,VS 2019 的 x64 Native Tools 命令提示字元捷徑的目標會類似於:%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
架構特定的批次檔會設定 architecture 參數並呼叫 vcvarsall.bat 。 您可以將相同的選項傳遞給這些批次檔,就像傳遞至 vcvarsall.bat 一樣,也可以直接呼叫 vcvarsall.bat 。 若要為您自己的命令捷徑指定參數,請將參數新增至命令結尾處,並以雙引號括住。 例如,以下是使用最新 Windows SDK 在 64 位平臺上建置 UWP ARM 程式碼的快捷方式。 若要使用先前的編譯器工具組,請指定版本號碼。 請在您的捷徑中使用如下的命令目標:%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm uwp -vcvars_ver=14.29
調整路徑以反映 Visual Studio 安裝目錄。 Vcvarsall.bat 檔案含有關於特定版本號碼的其他資訊。

Install TA-Lib C Library on Windows 10
[*]Download and Unzip ta-lib-0.4.0-msvc.zip
[*]Move the Unzipped Folder ta-lib to C:\
[*]Download and Install Visual Studio Community 2015
[*]Remember to Select Feature
[*]Build TA-Lib Library
[*]From Windows Start Menu, Start
[*]Move to C:\ta-lib\c\make\cdr\win32\msvc
[*]Build the Library nmake
[*]Then pip3 install ta-lib
Installed Visual Studio Community and ran VS2015 x64 Native Tools Command Prompt
nmake worked and pip install worked.Install TA-Lib C Library on Windows 10
[*]Download and Unzip ta-lib-0.4.0-msvc.zip
[*]Move the Unzipped Folder ta-lib to C:\
[*]Download and Install Visual Studio Community 2019
[*]Remember to Select Feature, tick the box 'desktop development with c++' under desktop/mobile section
[*]Build TA-Lib Library
[*]From Windows Start Menu, Start
[*]Move to C:\ta-lib\c\make\cdr\win32\msvc
[*]Build the Library nmake
[*]Then python -m pip install TA-Lib
頁: [1]
查看完整版本: how to install Ta-lib with python 3.11 in Windows