我正在尝试在Heroku上托管我的Discord.py机器人。当我的机器人启动时,出现以下错误:
2020-01-31T20:49:31.501236+00:00 heroku[worker.1]: State changed from starting to up
2020-01-31T20:49:32.858327+00:00 heroku[worker.1]: State changed from up to crashed
2020-01-31T20:49:32.839912+00:00 heroku[worker.1]: Process exited with status 1
2020-01-31T20:49:32.766672+00:00 app[worker.1]: Traceback (most recent call last):
2020-01-31T20:49:32.766696+00:00 app[worker.1]: File "bot.py", line 3, in <module>
2020-01-31T20:49:32.766815+00:00 app[worker.1]: import discord
2020-01-31T20:49:32.766819+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/discord/__init__.py", line 23, in <module>
2020-01-31T20:49:32.766952+00:00 app[worker.1]: from .client import Client
2020-01-31T20:49:32.766954+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/discord/client.py", line 35, in <module>
2020-01-31T20:49:32.767061+00:00 app[worker.1]: import websockets
2020-01-31T20:49:32.767062+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/websockets/__init__.py", line 3, in <module>
2020-01-31T20:49:32.767164+00:00 app[worker.1]: from .auth import *
2020-01-31T20:49:32.767166+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/websockets/auth.py", line 15, in <module>
2020-01-31T20:49:32.767263+00:00 app[worker.1]: from .server import HTTPResponse, WebSocketServerProtocol
2020-01-31T20:49:32.767265+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/websockets/server.py", line 49, in <module>
2020-01-31T20:49:32.767374+00:00 app[worker.1]: from .protocol import WebSocketCommonProtocol
2020-01-31T20:49:32.767375+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/websockets/protocol.py", line 18, in <module>
2020-01-31T20:49:32.767487+00:00 app[worker.1]: from typing import (
2020-01-31T20:49:32.767492+00:00 app[worker.1]: ImportError: cannot import name 'Deque'
我该如何解决?
该websockets
模块与python 3.6.0不兼容
我自己重现了这个问题:
C:\Users\Me>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
C:\Users\Me>pip install websockets
Collecting websockets
Downloading https://files.pythonhosted.org/packages/6a/bd/8555c65b3fca7310b2601d0957b36511c3c3c2e8a93a6d3f90c671b70c6a/websockets-8.0.2-cp36-cp36m-win_amd64.whl (65kB)
|████████████████████████████████| 71kB 918kB/s
Installing collected packages: websockets
Successfully installed websockets-8.0.2
WARNING: You are using pip version 19.1.1, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\Me>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import websockets
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Me\AppData\Local\Programs\Python\Python36\lib\site-packages\websockets\__init__.py", line 3, in <module>
from .auth import *
File "C:\Users\Me\AppData\Local\Programs\Python\Python36\lib\site-packages\websockets\auth.py", line 15, in <module>
from .server import HTTPResponse, WebSocketServerProtocol
File "C:\Users\Me\AppData\Local\Programs\Python\Python36\lib\site-packages\websockets\server.py", line 49, in <module>
from .protocol import WebSocketCommonProtocol
File "C:\Users\Me\AppData\Local\Programs\Python\Python36\lib\site-packages\websockets\protocol.py", line 18, in <module>
from typing import (
ImportError: cannot import name 'Deque'
它在3.6.1中有效:https : //repl.it/repls/NotableDarkorchidBloatware
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句