“未解决的导入'请求'”,但代码仍然可以运行(VSCode)

时间:2019-04-02 02:39:29

标签: python-3.x vscode-settings

代码可以运行和调试 但显示“未解决的导入'请求'Python(unresolved-import)” 我还有其他设置吗?

import requests
import os
url = 'https://www.google.com'
response = requests.get(url)
response.encoding = 'utf-8'
html = response.text
path = os.path.abspath(os.path.dirname(__file__))+'\\test.txt'
with open(path, 'w', encoding = 'gbk') as f:
    f.write(html)

1 个答案:

答案 0 :(得分:0)

您正在与虚拟环境中的Python解释器一起工作吗?