python - 使用 TA-lib 遇到 ImportError: cannot import name '__TA_FUNCTION_NAMES__'
问题描述
有人遇到过 Ta-lib 的问题吗?我无法导入任何函数,库似乎安装正确(从 .whl 文件安装,使用 pip 列表检查):
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
解决方案
推荐阅读
- sql - Rails / ActiveRecord / SQL 根据最高优先级,每个 user_id 仅返回 1 个条目
- python - 使用 pip 安装后导入 tensorflow 和 tflearn 时出错
- sql - 匹配来自不同表的两列的电子邮件域@xxxx.com
- azure - PowerShell 获取 Azure AD 应用程序证书信息
- php - 查询数据库,并将结果传递给单独文件中的子类
- python - Chrome开发工具不显示类,但python beautifulsoup find函数显示类
- snowflake-cloud-data-platform - 跨区域的雪花复制:增加任一端的仓库大小会影响速度吗?
- html - 如何将元素移动到页面下方?
- amazon-web-services - 无论如何要找到 HIVE_BAD_DATA 的罪魁祸首?
- swift - 在弹出 UIViewController 之前向上滚动 UITableView