我写这段代码:
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
from yahoofinancials import YahooFinancials
yahoo_finance = YahooFinancials(str(stock))
stats=(yahoo_finance.get_historical_price_data("2010-01-01", "2021-04-30", "daily"))
我已经安装了yahoo-finance1.4.0、yahoo Financials 1.6、yfinance0.1.59,请尝试一下
依次输入以下四行,每行执行一次:
pip install yahoo-finance
git clone git://github.com/lukaszbanasiak/yahoo-finance.git
cd yahoo-finance
python setup.py install
但仍然是显示错误“没有名为‘yahoofinancials’的模块”
我已经检查了此代码“>;pip show Yahoo Financials”并获得了此信息
Name: yahoofinancials
Version: 1.6
Summary: A powerful financial data module used for pulling both fundamental and technical data from Yahoo Finance
Home-page: https://github.com/JECSand/yahoofinancials
Author: Connor Sanders
Author-email: connor@exceleri.com
License: MIT
Location: c:\users\user\stockspredct\lib\site-packages
Requires: beautifulsoup4, pytz
Required-by:
请帮助我如何修复此错误
我安装了上述所有内容(包括beautifulsoup4和pytz),并收到了相同的错误消息
我稍微修改了代码,没有收到任何错误消息
问候塞缪尔
它应该按照您使用它的方式工作。可能的问题可能是环境变化。通过查看yahoofinancials库在pip中的位置,我认为您是在虚拟环境中安装它的,也许您的其他库也在您的全球环境中。检查您是否已激活虚拟环境,或尝试在全球环境中安装yahoofinancials
相关问题 更多 >
编程相关推荐