gpt4 book ai didi

Can't import google.appengine.api(无法导入google.appEng.api)

转载 作者:bug小助手 更新时间:2023-10-25 21:31:07 26 4
gpt4 key购买 nike



This should be pretty basic as I've installed lots of Python packages, but I can't for the life of my get Google APIs client library for python to install.

这应该是非常基本的,因为我已经安装了很多Python包,但我无法在我的Get Google API客户端库的整个生命周期中安装Python。


I'm pressure sure I've gone through the instructions on this website properly:
https://developers.google.com/api-client-library/python/start/installation

我确信我已经正确地阅读了这个网站上的说明:https://developers.google.com/api-client-library/python/start/installation


To summarize I've done the following:

总而言之,我做了以下几件事:


$ easy_install --upgrade google-api-python-client

this seems to work fine, doesn't report any errors or warnings

这似乎工作正常,不报告任何错误或警告


Downloaded and unzipped google-api-python-client-gae-1.2.zip into the directory where my project is.

下载并解压缩google-api-python-client-gae-1.2.zip到我的项目所在的目录。


But if I open an iPython session in the folder where I unpacked the full dependencies I can't do the basic imports such as:

但是,如果我在解压完整依赖项的文件夹中打开IPython会话,则无法执行基本的导入操作,例如:


import google.appengine.api it just says

导入google.appengine.api它只是说



"No Module named google.appengine.api"



I checked in my site-packages folder and google_api_python_client-1.2-py2.7.egg is there. But it doesn't show up in sys.path

我查看了我的Site-Packages文件夹,发现Google_API_Python_Client-1.2-py2.7.egg就在那里。但它不会显示在sys.Path中


when I do sys.path.append('C:\Anaconda\Lib\site-packages\google_api_python_cli
ent-1.2-py2.7.egg') it adds the correct path, but the import still doesn't work.

当我执行sys.path.append(‘C:\Anaconda\Lib\site-packages\google_api_python_cli时,它会添加正确的路径,但导入仍然不起作用。


EDIT: This fixed my problem

编辑:这解决了我的问题


Adding the Google SDK to my Python path did the trick. I don't know why the installer didn't do this when I ran it. but hey, this worked

将Google SDK添加到我的Python路径中起到了作用。我不知道为什么安装程序在我运行它的时候没有这样做。但是,嘿,这招奏效了


So if I run:

所以如果我参选:


sys.path.append('C:\\Program Files (x86)\\Google\\google_appengine')

from google.appengine import api

works!

奏效了!


更多回答

See answer here for same issue: stackoverflow.com/a/40471522/7049567

请在此处查看相同问题的答案:Stackoverflow.com/a/40471522/7049567

Where is the google_appengine folder? I can't find it after installing Google Cloud SDK for Python...

Google_appEngine文件夹在哪里?在安装了Google Cloud SDK for Python后,我找不到它...

优秀答案推荐

Without knowing all the steps you took to install app engine and the client APIs, my only recommendation is to install (or reinstall) the Google App Engine Python SDK from here: https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python. Looks like you're on windows, so you would grab the MSI.

在不了解安装应用引擎和客户端API的所有步骤的情况下,我唯一的建议是从这里安装(或重新安装)Google App Engine Python SDK:https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python。看起来你在Windows上,所以你会抓住MSI。



Just make sure you launch the AppEngineLauncher application after installation as it will give you the option to create symlinks so you can run commands from terminal.

只需确保在安装后启动AppEngineering Launcher应用程序,因为它将为您提供创建符号链接的选项,以便您可以从终端运行命令。



You should also consider using https://pypi.org/project/appengine-python-standard/, a release of the App Engine services SDK for Python 3

您还应该考虑使用https://pypi.org/project/appengine-python-standard/,,这是针对Python3的App Engine服务SDK的一个版本


更多回答

So I already installed the App Engine SDK. And I can load and run examples from the AppEngineLauncher, so when run from the launcher, it's got the right imports. However I can't access those same imports from iPython or any other python script. I'll try adding the SDK path to my pythonpath.

所以我已经安装了App Engine SDK。我可以从AppEngineering Launcher加载和运行示例,因此当从启动器运行时,它具有正确的导入。但是,我不能从IPython或任何其他Python脚本访问这些相同的导入。我将尝试将SDK路径添加到我的pythonpath中。

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