如何在 Windows 11 上的 Python 3.12 上 pip 安装 TA-Lib? 请给我 cmd 或 VS code 终端的命令。
我尝试过:
pip install Ta-Lib
Defaulting to user installation because normal site-packages is not writeable
Collecting Ta-Lib
Using cached TA-Lib-0.4.28.tar.gz (357 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in c:\users\alan\appdata\roaming\python\python312\site-packages (from Ta-Lib) (1.26.3)
Building wheels for collected packages: Ta-Lib
Building wheel for Ta-Lib (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for Ta-Lib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
<string>:77: UserWarning: Cannot find ta-lib library, installation may fail.
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-312
creating build\lib.win-amd64-cpython-312\talib
copying talib\abstract.py -> build\lib.win-amd64-cpython-312\talib
copying talib\deprecated.py -> build\lib.win-amd64-cpython-312\talib
copying talib\stream.py -> build\lib.win-amd64-cpython-312\talib
copying talib\__init__.py -> build\lib.win-amd64-cpython-312\talib
running build_ext
building 'talib._ta_lib' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for Ta-Lib
Failed to build Ta-Lib
ERROR: Could not build wheels for Ta-Lib, which is required to install pyproject.toml-based projects
从这里获取最新的
zipfile
Python 3.12
:
https://github.com/TA-Lib/ta-lib-python/issues/127#issuecomment-1793716236
将
zipfile
提取到C:\
,就像这样C:\ta-lib
从以下位置下载并安装 Visual C++ 构建工具:
https://visualstudio.microsoft.com/visual-cpp-build-tools/
最后安装:
pip install ta-lib