我已经安装了Python3.3.3,并从"https://code.google.com/p/feedparser/downloads/list“下载了feedparser-5.1.3,并安装了该解析器。我还检查了这个位置的解析器:"C:\pyhton33\Lib\email“,文件名为"feedparser”。但我不知道为什么它不导入,并不断给我错误“没有模块命名为'feedparser‘”。代码如下:
import feedparser
import re
# Returns title and dictionary of word counts for an RSS feed
def getwordcounts(url):
# Parse the feed
d=feedparser.parse(url)
wc={}
# Loop over all the entries
for e in d.entries:
if 'summary' in e: summary=e.summary
else: summary=e.description
# Extract a list of words
words=getwords(e.title+' '+summary)
for word in words:
wc.setdefault(word,0)
wc[word]+=1
return d.feed.title,wc错误:
Traceback (most recent call last):
File "C:\Python33\generatefeedvector.py", line 1, in <module>
import feedparser
ImportError: No module named 'feedparser'有什么需要帮忙的吗?
发布于 2019-10-25 17:22:23
我找到了一个解决方案,它在我的电脑上运行(Python 3)。
从作者的页面https://github.com/kurtmckee/feedparser下载feedparser。
要安装feedparser,请将repo解压到:
C:\Users\The_name\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\"cmd“窗口将其安装为(整行):
C:\Users\The_name\AppData\Local\Programs\Python\Python37-32\Lib\feedparser-develop>python setup.py installpython setup.py安装
https://stackoverflow.com/questions/26623382
复制相似问题