嗨,我是 python 的新手,我在网上学习一些教程。当我尝试导入请求或 bs4 时,我使用的是最新版本的 python 3.6
ModuleNotFoundError,没有名为“请求”的模块
虽然它已安装,但我可以在站点包中看到它
这是代码
import requests
from bs4 import BeautifulSoup
import operator
def start(url):
word_list = []
source_code = requests.get(url).text
soup = BeautifulSoup(source_code)
for post_text in soup.findAll('div'):
content = post_text.string
words = content.lower().split()
for each_word in words:
print(each_word)
word_list.append(each_word)
start('http://localhost/budget_app/dashboard.php')
这是错误
ModuleNotFoundError, No module named 'requests'
原文由 Avi Teller 发布,翻译遵循 CC BY-SA 4.0 许可协议
在您的虚拟环境中运行以下命令: