Par*_*kar 9 python artificial-intelligence algorithmic-trading technical-indicator
我在 pip 安装 ta-lib 时遇到以下错误。\n我使用了命令:
\n!pip install ta-lib\n
Run Code Online (Sandbox Code Playgroud)\n请为我提供解决方案。
\n Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\nCollecting ta-lib\n Using cached TA-Lib-0.4.25.tar.gz (271 kB)\n Installing build dependencies ... done\n Getting requirements to build wheel ... done\n Installing backend dependencies ... done\n Preparing metadata (pyproject.toml) ... done\nRequirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from ta-lib) (1.21.6)\nBuilding wheels for collected packages: ta-lib\n error: subprocess-exited-with-error\n \n \xc3\x97 Building wheel for ta-lib (pyproject.toml) did not run successfully.\n \xe2\x94\x82 exit code: 1\n \xe2\x95\xb0\xe2\x94\x80> See above for output.\n \n note: This error originates from a subprocess, and is likely not a problem with pip.\n Building wheel for ta-lib (pyproject.toml) ... error\n ERROR: Failed building wheel for ta-lib\nFailed to build ta-lib\nERROR: Could not build wheels for ta-lib, which is required to install pyproject.toml-based projects\n
Run Code Online (Sandbox Code Playgroud)\n我尝试了以下命令:
\npip install --upgrade pip setuptools wheel\n
Run Code Online (Sandbox Code Playgroud)\npip install pep517\n
Run Code Online (Sandbox Code Playgroud)\n!pip3 install --upgrade pip\n
Run Code Online (Sandbox Code Playgroud)\n!pip install pyproject-toml\n
Run Code Online (Sandbox Code Playgroud)\npip install TA_Lib\xe2\x80\x910.4.10\xe2\x80\x91cp35\xe2\x80\x91cp35m\xe2\x80\x91win_amd64.whl\n
Run Code Online (Sandbox Code Playgroud)\n!pip install ta-lib\n
Run Code Online (Sandbox Code Playgroud)\n
小智 13
在 Anaconda 命令提示符中键入以下命令(完全像这样)为我解决了这个问题:
conda install -c conda-forge ta-lib
Run Code Online (Sandbox Code Playgroud)
希望这也能节省其他人的时间。
小智 10
在 Ubuntu 22.04 中,我按照以下步骤解决了这个问题;
(顺便说一句,这里的官方页面也提到了)
cd ~/talib
和;tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr
make
sudo make install
在您的主目录中编辑 .bashrc 并添加以下行:请记住将PREFIX更改为您的 talib 路径 (~/talib/ta-lib/)
导出 TA_LIBRARY_PATH=$ PREFIX /lib
导出 TA_INCLUDE_PATH=$ PREFIX /include
pip install TA-Lib
然后就安装成功了。祝你好运!