【发布时间】:2018-05-27 13:04:37
【问题描述】:
在我使用 pubsub 和 Google App Engine 时,我在尝试导入 pubsub_v1 时遇到了 psutil 的一些问题。 当我单独运行 Pubsub 时,它做得很好,但是当我将 dev_appserver 用于应用引擎时,我得到了这个回溯:
Traceback (most recent call last):
File "/Users/soussa77/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Users/soussa77/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Users/soussa77/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 96, in LoadObject
__import__(cumulative_path)
File "/Users/soussa77/PycharmProjects/my-project/apps/app1/src/main.py", line 4, in <module>
from src.apis.app1 import App1Api
File "/Users/soussa77/PycharmProjects/my-project/apps/app1/src/apis/app1.py", line 11, in <module>
from google.cloud import pubsub_v1
File "/Users/soussa77/PycharmProjects/my-project/apps/app1/lib/google/cloud/pubsub_v1/__init__.py", line 17, in <module>
from google.cloud.pubsub_v1 import types
File "/Users/soussa77/PycharmProjects/my-project/app/waterp/lib/google/cloud/pubsub_v1/types.py", line 17, in <module>
import psutil
File "/Users/soussa77/PycharmProjects/my-project/apps/app1/lib/psutil/__init__.py", line 156, in <module>
from . import _psosx as _psplatform
File "/Users/soussa77/PycharmProjects/my-project/apps/app1/lib/psutil/_psosx.py", line 16, in <module>
from . import _psutil_osx as cext
File "/Users/soussa77/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/sandbox.py", line 1091, in load_module
raise ImportError('No module named %s' % fullname)
**ImportError: No module named psutil._psutil_osx**
当 pubsub 尝试监视 cpu 活动时,它似乎在 psutil 上失败了。
【问题讨论】:
标签: python python-2.7 google-app-engine google-cloud-pubsub