pip 期间 pygooglenews 和 feedparser 错误

问题描述 投票:0回答:1

pip 安装 pygooglenews --升级

Collecting pygooglenews
  Obtaining dependency information for pygooglenews from https://files.pythonhosted.org/packages/59/cb/84f162888a07e501630f6be7c70997c5c8afd5ba4a40c3a079c321e97c29/pygooglenews-0.1.2-py3-none-any.whl.metadata
  Using cached pygooglenews-0.1.2-py3-none-any.whl.metadata (19 kB)
Requirement already satisfied: beautifulsoup4<5.0.0,>=4.9.1 in c:\users\valer\anaconda3\lib\site-packages (from pygooglenews) (4.12.2)
Collecting dateparser<0.8.0,>=0.7.6 (from pygooglenews)
  Obtaining dependency information for dateparser<0.8.0,>=0.7.6 from https://files.pythonhosted.org/packages/c1/d5/5a2e51bc0058f66b54669735f739d27afc3eb453ab00520623c7ab168e22/dateparser-0.7.6-py2.py3-none-any.whl.metadata
  Using cached dateparser-0.7.6-py2.py3-none-any.whl.metadata (26 kB)
Collecting feedparser<6.0.0,>=5.2.1 (from pygooglenews)
  Using cached feedparser-5.2.1.zip (1.2 MB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
  error: subprocess-exited-with-error
  
  python setup.py egg_info did not run successfully.
  exit code: 1

[1行输出] feedparser 设置命令错误:use_2to3 无效。 [输出结束]

注意:此错误源自子进程,并且可能不是 pip 的问题。 错误:元数据生成失败

生成包元数据时遇到错误。

参见上面的输出。

注意:这是上面提到的包的问题,而不是 pip 的问题。 提示:详细信息请参见上文。

我正在尝试运行这个学习项目:

from pygooglenews import GoogleNews 
from collections  import Counter

gn = GoogleNews(lang='pt' , country="BR")

initial_year = 2020
until_year =  2024
search_word = 'Goku'

counts = Counter()

for year in range(initial_year, until_year + 1):
    for month in range(1,13):
        if year == until_year and month > 3:
            break
    search = gn.search(f'{search_word} after:{year}-{month:02d}-01 before:{year}-{month:02d}-28')
    counts[year] += sum(search_word in entry['title'] for entry in search['entries'])

python google-chrome
1个回答
0
投票

这里也一样,它不起作用。您找到解决方案或其他替代方案了吗?

© www.soinside.com 2019 - 2024. All rights reserved.