2016-12-15 331 views
1

在Python中安裝TA-Lib軟件包困難重重。Python TA-Lib安裝問題

https://pypi.python.org/pypi/TA-Lib

我已經經歷了所有的論壇帖子我可以找到關於這一點,但沒有這樣的運氣我的具體問題讀..

的Windows 10 的Python 3.5.2 蟒蛇4.2.0 用Cython 0.24.1 微軟的Visual Studio 14.0

我已經下載並提取ta-lib-0.4.0-msvc.zip到C:/ TA-Lib的 (常見的問題似乎不安裝底層TA-Lib的人文件http://www.ta-lib.org/hdr_dw.html

如果有人能幫我解決這個問題,我會非常感激!

使用「PIP安裝TA-lib的」我得到以下幾點:

C:\Users\Matt>pip install ta-lib 
Collecting ta-lib 
    Using cached TA-Lib-0.4.10.tar.gz 
Building wheels for collected packages: ta-lib 
    Running setup.py bdist_wheel for ta-lib ... error 
    Complete output from command c:\users\matt\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Matt\\AppData\\Local\\Temp\\pip-build-vv02ktg_\\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 C:\Users\Matt\AppData\Local\Temp\tmpqstzmsgspip-wheel- --python-tag cp35: 
    running bdist_wheel 
    running build 
    running build_py 
    creating build 
    creating build\lib.win-amd64-3.5 
    creating build\lib.win-amd64-3.5\talib 
    copying talib\deprecated.py -> build\lib.win-amd64-3.5\talib 
    copying talib\test_abstract.py -> build\lib.win-amd64-3.5\talib 
    copying talib\test_data.py -> build\lib.win-amd64-3.5\talib 
    copying talib\test_func.py -> build\lib.win-amd64-3.5\talib 
    copying talib\test_stream.py -> build\lib.win-amd64-3.5\talib 
    copying talib\__init__.py -> build\lib.win-amd64-3.5\talib 
    running build_ext 
    skipping 'talib\common.c' Cython extension (up-to-date) 
    building 'talib.common' extension 
    creating build\temp.win-amd64-3.5 
    creating build\temp.win-amd64-3.5\Release 
    creating build\temp.win-amd64-3.5\Release\talib 
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\matt\anaconda3\lib\site-packages\numpy\core\include -Ic:\ta-lib\c\include -Ic:\users\matt\anaconda3\include -Ic:\users\matt\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tctalib\common.c /Fobuild\temp.win-amd64-3.5\Release\talib\common.obj 
    common.c 
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\ta-lib\c\lib /LIBPATH:c:\users\matt\anaconda3\libs /LIBPATH:c:\users\matt\anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" ta_libc_cdr.lib /EXPORT:PyInit_common build\temp.win-amd64-3.5\Release\talib\common.obj /OUT:build\lib.win-amd64-3.5\talib\common.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\talib\common.cp35-win_amd64.lib 
    common.obj : warning LNK4197: export 'PyInit_common' specified multiple times; using first specification 
    Creating library build\temp.win-amd64-3.5\Release\talib\common.cp35-win_amd64.lib and object build\temp.win-amd64-3.5\Release\talib\common.cp35-win_amd64.exp 
    common.obj : error LNK2001: unresolved external symbol TA_SetUnstablePeriod 
    common.obj : error LNK2001: unresolved external symbol TA_Shutdown 
    common.obj : error LNK2001: unresolved external symbol TA_Initialize 
    common.obj : error LNK2001: unresolved external symbol TA_GetUnstablePeriod 
    common.obj : error LNK2001: unresolved external symbol TA_GetVersionString 
    build\lib.win-amd64-3.5\talib\common.cp35-win_amd64.pyd : fatal error LNK1120: 5 unresolved externals 
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1120 

    ---------------------------------------- 
    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 c:\users\matt\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Matt\\AppData\\Local\\Temp\\pip-build-vv02ktg_\\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\Matt\AppData\Local\Temp\pip-qxmjmn5m-record\install-record.txt --single-version-externally-managed --compile: 
    running install 
    running build 
    running build_py 
    creating build 
    creating build\lib.win-amd64-3.5 
    creating build\lib.win-amd64-3.5\talib 
    copying talib\deprecated.py -> build\lib.win-amd64-3.5\talib 
    copying talib\test_abstract.py -> build\lib.win-amd64-3.5\talib 
    copying talib\test_data.py -> build\lib.win-amd64-3.5\talib 
    copying talib\test_func.py -> build\lib.win-amd64-3.5\talib 
    copying talib\test_stream.py -> build\lib.win-amd64-3.5\talib 
    copying talib\__init__.py -> build\lib.win-amd64-3.5\talib 
    running build_ext 
    skipping 'talib\common.c' Cython extension (up-to-date) 
    building 'talib.common' extension 
    creating build\temp.win-amd64-3.5 
    creating build\temp.win-amd64-3.5\Release 
    creating build\temp.win-amd64-3.5\Release\talib 
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\matt\anaconda3\lib\site-packages\numpy\core\include -Ic:\ta-lib\c\include -Ic:\users\matt\anaconda3\include -Ic:\users\matt\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tctalib\common.c /Fobuild\temp.win-amd64-3.5\Release\talib\common.obj 
    common.c 
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c:\ta-lib\c\lib /LIBPATH:c:\users\matt\anaconda3\libs /LIBPATH:c:\users\matt\anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" ta_libc_cdr.lib /EXPORT:PyInit_common build\temp.win-amd64-3.5\Release\talib\common.obj /OUT:build\lib.win-amd64-3.5\talib\common.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\talib\common.cp35-win_amd64.lib 
    common.obj : warning LNK4197: export 'PyInit_common' specified multiple times; using first specification 
     Creating library build\temp.win-amd64-3.5\Release\talib\common.cp35-win_amd64.lib and object build\temp.win-amd64-3.5\Release\talib\common.cp35-win_amd64.exp 
    common.obj : error LNK2001: unresolved external symbol TA_SetUnstablePeriod 
    common.obj : error LNK2001: unresolved external symbol TA_Shutdown 
    common.obj : error LNK2001: unresolved external symbol TA_Initialize 
    common.obj : error LNK2001: unresolved external symbol TA_GetUnstablePeriod 
    common.obj : error LNK2001: unresolved external symbol TA_GetVersionString 
    build\lib.win-amd64-3.5\talib\common.cp35-win_amd64.pyd : fatal error LNK1120: 5 unresolved externals 
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1120 

    ---------------------------------------- 
Command "c:\users\matt\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Matt\\AppData\\Local\\Temp\\pip-build-vv02ktg_\\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\Matt\AppData\Local\Temp\pip-qxmjmn5m-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Matt\AppData\Local\Temp\pip-build-vv02ktg_\ta-lib\ 

回答

5

你可以嘗試「非官方的Windows可執行文件的Python擴展包 由克里斯托夫Gohlke,實驗室熒光動力學,加州大學,歐文「。

​​

他取決於操作系統和Python版本編譯不同的版本。您可能需要TA_Lib-0.4.10-cp35-cp35m-win_amd64.whl

祝你好運。

0

我在下載TA-lib時遇到很多困難。我正在使用Windows 7並已安裝Python 3.5。我已經嘗試了很多解決方案,失去了多少。已經下載了zip文件,tar和whl文件都沒有成功。使用zip文件,它會引發錯誤,並找不到setup.py。我認爲TAR不起作用,因爲它不適用於Windows,最後whl文件根本不被我的命令行識別。我已經閱讀了堆棧溢出和TA-lib所有者的許多帖子,如果有人能找到我一個解決方案,我會非常感激!

因此,我安裝微軟的Visual Studio正如有人從堆棧溢出推薦並遵循推薦給更改命令行解壓縮的文件位置的目錄,然後運行以下命令:

python setup.py install 

這似乎工作在第一,但隨後引發了以下錯誤:

C:\dist>cd TA-Lib-0.4.10 

C:\dist\TA-Lib-0.4.10>python setup.py install 
running install 
running build 
running build_py 
running build_ext 
skipping 'talib\common.c' Cython extension (up-to-date) 
building 'talib.common' extension 
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c/
nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Administrator\AppData\Local\Programs\ 
Python\Python36\lib\site-packages\numpy\core\include -Ic:\ta-lib\c\include -IC:\ 
Users\Administrator\AppData\Local\Programs\Python\Python36\include -IC:\Users\Ad 
ministrator\AppData\Local\Programs\Python\Python36\include "-IC:\Program Files (
x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows 
Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\in 
clude\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Progr 
am Files (x86)\Windows Kits\8.1\include\winrt" /Tctalib\common.c /Fobuild\temp.w 
in-amd64-3.6\Release\talib\common.obj 
common.c 
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /n 
ologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:c 
:\ta-lib\c\lib /LIBPATH:C:\Users\Administrator\AppData\Local\Programs\Python\Pyt 
hon36\libs /LIBPATH:C:\Users\Administrator\AppData\Local\Programs\Python\Python3 
6\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC 
\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\uc 
rt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" ta 
_libc_cdr.lib /EXPORT:PyInit_common build\temp.win-amd64-3.6\Release\talib\commo 
n.obj /OUT:build\lib.win-amd64-3.6\talib\common.cp36-win_amd64.pyd /IMPLIB:build 
\temp.win-amd64-3.6\Release\talib\common.cp36-win_amd64.lib 
common.obj : warning LNK4197: export 'PyInit_common' specified multiple times; u 
sing first specification 
    Creating library build\temp.win-amd64-3.6\Release\talib\common.cp36-win_amd64 
.lib and object build\temp.win-amd64-3.6\Release\talib\common.cp36-win_amd64.exp 

common.obj : error LNK2001: unresolved external symbol TA_SetUnstablePeriod 
common.obj : error LNK2001: unresolved external symbol TA_Shutdown 
common.obj : error LNK2001: unresolved external symbol TA_Initialize 
common.obj : error LNK2001: unresolved external symbol TA_GetUnstablePeriod 
common.obj : error LNK2001: unresolved external symbol TA_GetVersionString 
build\lib.win-amd64-3.6\talib\common.cp36-win_amd64.pyd : fatal error LNK1120: 5 
unresolved externals 
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\ 
x86_amd64\\link.exe' failed with exit status 1120