gpt4 book ai didi

Python 3.6 导入请求

转载 作者:太空狗 更新时间:2023-10-30 01:57:09 25 4
gpt4 key购买 nike

嗨,我是 Python 的新手,我正在学习一些在线教程。当我尝试导入请求或 bs4 时,我使用的是最新版本的 python 3.6

ModuleNotFoundError,没有名为“requests”的模块

虽然它已安装,但我可以在站点包中看到它,我使用 pip 来安装我似乎要安装的任何东西,但似乎无法找到它

这是代码

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'

最佳答案

在您的虚拟环境中运行以下命令:

sudo pip install requests

关于Python 3.6 导入请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43727362/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com