我有一个非常简单的程序,我从谷歌的工作区复制的,导入语句如下
import os.path
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
当我运行这个代码时,我不断得到:
from google.auth.transport.requests import Request
ModuleNotFoundError: No module named 'google'
我已经在这里通过了每一个问题的话题,皮普安装了世界,仍然没有爱.我创建了一个Requirements.txt文件,并使用pip show获得了安装在我的C:\Python310\Lib\Site-Packages\中的当前版本,这些版本与C:\Python310\和C:\Python310\Script一起安装在我的路径中.
openai==1.14.0
langchain==0.1.12
streamlit==1.32.2
google==3.0.0
google-auth==2.28.2
requests-oauthlib==1.4.0
google_auth_oauthlib==1.2.0
oauthlib==3.2.2
google-api-python-client==2.122.0
在VSCode中,需求文档没有显示缺失的引用,但我一直得到相同的错误. 我甚至通过VSCode Insense,手动重新创建了每个import语句,没有任何问题. 所以VSCode看到模块,但我仍然得到相同的错误.
有人能帮我一下吗?
谢谢您抽时间见我.
100*
# Imports
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
import base64
from email.mime.text import MIMEText
# Authenticate
SCOPES = ['https://www.googleapis.com/auth/gmail.readonly',
'https://www.googleapis.com/auth/gmail.modify']
creds = Credentials.from_authorized_user_file('token.json', SCOPES)
service = build('gmail', 'v1', credentials=creds)
service.users().messages().list(userId='me', maxResults=10).execute()