Python 使用TA库时遇到导入错误:无法导入名称'__TA#u函数(名称)';
有没有人曾经面临过Ta lib的问题?我无法导入任何函数,库似乎已正确安装(从.whl文件安装,使用pip列表检查):Python 使用TA库时遇到导入错误:无法导入名称'__TA#u函数(名称)';,python,ta-lib,Python,Ta Lib,有没有人曾经面临过Ta lib的问题?我无法导入任何函数,库似乎已正确安装(从.whl文件安装,使用pip列表检查): 导入talib 特征名称=['5d\U关闭\U pct'] #创建14、30、50、200个时间段的移动平均值和rsi 时间段列表=[14,30,50,200] 对于\u时间段列表\u中的n: #创建移动平均线指示器并除以Adj_Close 返回_数据['ma'+str(n)]=talib.SMA(返回_数据['Adj_Close']。值,时间段=n)/返回_数据['Adj_C
导入talib
特征名称=['5d\U关闭\U pct']
#创建14、30、50、200个时间段的移动平均值和rsi
时间段列表=[14,30,50,200]
对于\u时间段列表\u中的n:
#创建移动平均线指示器并除以Adj_Close
返回_数据['ma'+str(n)]=talib.SMA(返回_数据['Adj_Close']。值,时间段=n)/返回_数据['Adj_Close']
#创建RSI指标
返回_数据['rsi'+str(n)]=talib.rsi(返回_数据['Adj_Close']。值,时间段=n)
#将RSI和MA添加到功能名称列表中
特征名称=特征名称+['ma'+str(n),'rsi'+str(n)]
打印(功能名称)
ImportError回溯(最近一次呼叫最后一次)
在里面
14#另一个常见的技术指标是相对强度指数(RSI)
15
--->16进口塔利布
17
18个要素名称=['5d\U关闭\U pct']
中的~\AppData\Local\Programs\Python\Python36\lib\site packages\talib\\uuuuu init\uuuuuu.py
41返回包装器
42
--->43从._ta_lib导入(
44(初始化),(关闭),(类型),(版本),,
45(设置)不稳定(周期)作为设置(不稳定)周期,,
ImportError:无法导入名称“\u\u TA\u函数\u名称”
import talib
feature_names = ['5d_close_pct']
# Create moving averages and rsi for timeperiods of 14, 30, 50, 200
list_of_timeperiods = [14, 30, 50, 200]
for n in list_of_timeperiods:
# Create the moving average indicator and divide by Adj_Close
returns_data['ma' + str(n)] = talib.SMA(returns_data['Adj_Close'].values, timeperiod=n)/returns_data['Adj_Close']
# Create the RSI indicator
returns_data['rsi' + str(n)] = talib.RSI(returns_data['Adj_Close'].values, timeperiod=n)
# Add RSI and MA to the feature name list
feature_names = feature_names + ['ma' + str(n), 'rsi' + str(n)]
print (feature_names)
ImportError Traceback (most recent call last)
<ipython-input-27-5350715961d9> in <module>
14 # Another common technical indicator is the relative strength index (RSI)
15
---> 16 import talib
17
18 feature_names = ['5d_close_pct']
~\AppData\Local\Programs\Python\Python36\lib\site-packages\talib\__init__.py in <module>
41 return wrapper
42
---> 43 from ._ta_lib import (
44 _ta_initialize, _ta_shutdown, MA_Type, __ta_version__,
45 _ta_set_unstable_period as set_unstable_period,
ImportError: cannot import name '__TA_FUNCTION_NAME