相关疑难解决方法(0)

ModuleNotFoundError:没有名为 openai 的模块

import requests
from bs4 import BeautifulSoup
import openai 

#write each line of nuclear.txt to a list
with open('nuclear.txt', 'r') as f:
    lines = f.readlines()

#remove the newline character from each line
lines = [line.rstrip() for line in lines]

#gather the text from each website and add it to a new txt file
for line in lines:
    r = requests.get(line)
    soup = BeautifulSoup(r.text, 'html.parser')
    text = soup.get_text()
    with open('nuclear_text.txt', 'a') as f:
        f.write(text)

Run Code Online (Sandbox Code Playgroud)

我正在尝试导入 openai,但它不断抛出错误“未找到模块”。我已经完成了 pip install openai 并下载了它,但它似乎是错误的 python 版本。如何选择正确的 …

python interpreter visual-studio-code

6
推荐指数
2
解决办法
3万
查看次数

标签 统计

interpreter ×1

python ×1

visual-studio-code ×1