簡體   English   中英

在Ubuntu 16 Python3上安裝TA-Lib時出錯

[英]Error Installing TA-Lib on Ubuntu 16 Python3

我在Ubuntu 16上

$ pip -V
pip 18.0 from /home/XYZ-ubuntu/.local/lib/python3.6/site-packages/pip (python 3.6)
XYZ-ubuntu@XYZubuntu-desktop:~/Desktop/MCF/BitMEX-simple-trading-robot-master$ pip3 -V
pip 18.0 from /home/usm-ubuntu/.local/lib/python3.6/site-packages/pip (python 3.6)

當我運行這個:

pip安裝TA-lib

我收到以下錯誤:

$ pip install TA-lib
Collecting TA-lib
  Using cached https://files.pythonhosted.org/packages/90/05/d4c6a778d7a7de0be366bc4a850b4ffaeac2abad927f95fa8ba6f355a082/TA-Lib-0.4.17.tar.gz
Requirement already satisfied: numpy in /home/usm-ubuntu/.local/lib/python3.6/site-packages (from TA-lib) (1.15.1)
Building wheels for collected packages: TA-lib
  Running setup.py bdist_wheel for TA-lib ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-72o18u12/TA-lib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-3i94vijy --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/talib
  copying talib/abstract.py -> build/lib.linux-x86_64-3.6/talib
  copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
  copying talib/test_pandas.py -> build/lib.linux-x86_64-3.6/talib
  copying talib/stream.py -> build/lib.linux-x86_64-3.6/talib
  copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
  copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
  copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
  copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
  copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
  running build_ext
  building 'talib._ta_lib' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/talib
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/usm-ubuntu/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/usr/include/python3.6m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.6/talib/_ta_lib.o
  talib/_ta_lib.c:4:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  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 /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-72o18u12/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 /tmp/pip-record-bsagqzqb/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/talib
    copying talib/abstract.py -> build/lib.linux-x86_64-3.6/talib
    copying talib/test_func.py -> build/lib.linux-x86_64-3.6/talib
    copying talib/test_pandas.py -> build/lib.linux-x86_64-3.6/talib
    copying talib/stream.py -> build/lib.linux-x86_64-3.6/talib
    copying talib/__init__.py -> build/lib.linux-x86_64-3.6/talib
    copying talib/test_stream.py -> build/lib.linux-x86_64-3.6/talib
    copying talib/test_abstract.py -> build/lib.linux-x86_64-3.6/talib
    copying talib/test_data.py -> build/lib.linux-x86_64-3.6/talib
    copying talib/deprecated.py -> build/lib.linux-x86_64-3.6/talib
    running build_ext
    building 'talib._ta_lib' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/talib
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/usm-ubuntu/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/usr/include/python3.6m -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.6/talib/_ta_lib.o
    talib/_ta_lib.c:4:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-72o18u12/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 /tmp/pip-record-bsagqzqb/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-72o18u12/TA-lib/

我一直在這里-

無法在Ubuntu上安裝TA-Lib

我已經花了幾個小時對此進行了搜索,但沒有結果。 有沒有人有辦法解決嗎? 謝謝

我通過升級到Ubuntu 18.04 LTS解決了這個問題。 我在2.7和3.5 / 3.6之間有沖突。

升級后,我使用nano〜 nano ~/.bashrcalias python = python3更改為python3,並添加行alias python = python3

然后通過運行命令安裝TA-lib:

python3 -m pip安裝TA-lib

現在一切正常。 謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM