我正在尝试:
import multiprocessing
但得到错误:
ERROR 2015-01-21 18:40:49,457 wsgi.py:263]
Traceback (most recent call last):
File "/home/nir/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/nir/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/nir/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/root/workspace/spring-nova-827/Main.py", line 2, in <module>
import multiprocessing
File "/usr/lib/python2.7/multiprocessing/__init__.py", line 84, in <module>
import _multiprocessing
File "/home/nir/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 898, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named _multiprocessing
我看了这个问题,但找不到解决方案
答案 0 :(得分:0)
您正在沙盒环境中运行,在这种情况下,您无法导入标准库中的某些模块(multiprocessing
)。
为什么需要multiprocessing
?可能您可以使用threading
来逃避,但这可能会带来性能影响,具体取决于您要实现的目标。我还注意到,concurrent.futures
也建议用于App Engine。
请参阅&#34; The Sandbox&#34;和#34;纯Python&#34;。 https://cloud.google.com/appengine/docs/python/