python3 error, cannot import name 'SimpleQueue'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/usr/bin/env python3 import logging; logging.basicConfig(level=logging.INFO) import asyncio, os, json, time from datetime import datetime from aiohttp import web def index(request): return web.Response(body=b'Awesome') @asyncio.coroutine def init(loop): app = web.Application(loop=loop) app.router.add_route('GET', '/', index) srv = yield from loop.create_server(app.make_handler(), '127.0.0.1', 9000) logging.info('server started at http://127.0.0.1:9000...') return srv loop = asyncio.get_event_loop() loop.run_until_complete(init(loop)) loop.run_forever() |
Process (28411) start...
I (28411) just created a child process (28412).
I am child process (28412) and my parent is 28411.
Traceback (most recent call last):
File"webApp.py", line 5, in
import asyncio, os, json, time
File"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/init.py", line 21, in
Traceback (most recent call last):
File"webApp.py", line 5, in
import asyncio, os, json, time
File"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/init.py", line 21, in
from .base_events import *
File"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py", line 18, in
from .base_events import *
File"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py", line 18, in
import concurrent.futures
File"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/concurrent/futures/init.py", line 17, in
import concurrent.futures
File"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/concurrent/futures/init.py", line 17, in
from concurrent.futures.process import ProcessPoolExecutor
File"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/concurrent/futures/process.py", line 54, in
from concurrent.futures.process import ProcessPoolExecutor
File"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/concurrent/futures/process.py", line 54, in
from multiprocessing import SimpleQueue
from multiprocessing import SimpleQueue
ImportError: cannot import name 'SimpleQueue'
ImportError: cannot import name 'SimpleQueue'
simpleQueue的API似乎已经改变了。
在python3.3中,它位于
在python3.2中,它位于
您可能运行了早于3.2的python版本,但代码是为较新版本(> = 3.3)编写的。 您可以尝试修改库以使用旧的导入或升级您的python版本。