AlphaCats 2021-06-28 21:11 采纳率: 62.5%
浏览 90

ImportError: DLL load failed: 找不到指定的模块。

import requests,jieba
from bs4 import BeautifulSoup
import matplotlib.pyplot as plt

url = 'https://news.so.com/hotnews?src=onebox'
res = requests.get(url)
bea = BeautifulSoup(res.text,'html.parser')
datas = bea.find_all(class_='title')
lists = []
lists2 = []
hot_datas = {}

for data in datas:
    lists.append(data.text)

lists = jieba.cut(''.join(lists))
for list in lists:
    lists2.append(list)

for x in lists2:
    if x in hot_datas:
        hot_datas[x] += 1
    else:
        hot_datas[x] = 1

mins = 1
has = []
ready_del = []


for hot in hot_datas.values():
    if hot > mins:
        mins = hot
    elif hot < mins:
        if hot not in has:
            for x in [k for k,v in hot_datas.items() if v==hot]:
                ready_del.append(x)
            has.append(hot)
            
for x in ready_del:
    hot_datas.pop(x)


for hot,lens in hot_datas.items():
    print('今日新闻出现频率最高的词:{}'.format(hot))
    print('频率:{}'.format(lens))

简单的爬虫程序

导入matplotlib出现

Traceback (most recent call last):
  File "c:/Users/xujinhao/Desktop/新闻.py", line 3, in <module>
    import matplotlib.pyplot as plt
  File "E:\许锦浩至尊文件夹2\许锦浩至尊文件夹\编程\lib\site-packages\matplotlib\__init__.py", line 174, in <module>       
    _check_versions()
  File "E:\许锦浩至尊文件夹2\许锦浩至尊文件夹\编程\lib\site-packages\matplotlib\__init__.py", line 159, in _check_versions
    from . import ft2font
ImportError: DLL load failed: 找不到指定的模块。
PS C:\Users\xujinhao> 


网上的卸载重装,环境变量    都试过了,环境变量好像是基于Anaconda的,但我用的是vs code

 

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-09-07 17:11
    关注
    不知道你这个问题是否已经解决, 如果还没有解决的话:

    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^
    评论

报告相同问题?

悬赏问题

  • ¥20 python忆阻器数字识别
  • ¥15 无法输出helloworld
  • ¥15 高通uboot 打印ubi init err 22
  • ¥20 PDF元数据中的XMP媒体管理属性
  • ¥15 R语言中lasso回归报错
  • ¥15 网站突然不能访问了,上午还好好的
  • ¥15 有没有dl可以帮弄”我去图书馆”秒选道具和积分
  • ¥15 semrush,SEO,内嵌网站,api
  • ¥15 Stata:为什么reghdfe后的因变量没有被发现识别啊
  • ¥15 振荡电路,ADS仿真