问题描述
出于某种原因,PyJTW 似乎不适用于我在 Ubuntu 16.04 上的 virtualenv,但它在我的本地 Windows 机器上运行良好(也在 venv 内).我一无所知,我尝试了不同的版本,复制了与我在 Windows 机器上完全相同的版本,但我仍然无法让它工作.
For some reason, PyJTW doesn't seem to work on my virtualenv on Ubuntu 16.04, but it worked fine on my local Windows machine (inside a venv too). I'm clueless, I've tried different versions, copied the exact same versions as I had on my Windows machine, and yet I still couldn't get this to work.
安装包:
Package Version
-------------------------- ---------
aiohttp 3.6.2
async-timeout 3.0.1
attrs 20.2.0
cachetools 4.1.1
certifi 2020.6.20
cffi 1.14.3
chardet 3.0.4
click 7.1.2
cryptography 2.9.2
DateTime 4.3
discord.py 1.5.0
Flask 1.1.2
Flask-Discord 0.1.61
flask-oidc 1.4.0
flask-oidc2 1.5.0
httplib2 0.18.1
idna 2.10
itsdangerous 1.1.0
Jinja2 2.11.2
jwt 1.0.0
MarkupSafe 1.1.1
multidict 4.7.6
mysql-connector-python 8.0.21
mysql-connector-repackaged 0.3.1
oauth2client 4.1.3
oauthlib 3.1.0
pip 20.2.3
protobuf 3.13.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.20
PyJWT 1.7.1
pytz 2020.1
requests 2.24.0
requests-oauthlib 1.3.0
rsa 4.6
schedule 0.6.0
setuptools 50.3.0
six 1.15.0
typing-extensions 3.7.4.3
urllib3 1.25.10
Werkzeug 1.0.1
wheel 0.35.1
yarl 1.6.0
zope.interface 5.1.0
错误:
[2020-09-29 21:58:44 +0000] [2036] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spaw n_worker
worker.init_process()
File "/usr/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/usr/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in l oad
return self.load_wsgiapp()
File "/usr/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in l oad_wsgiapp
return util.import_app(self.app_uri)
File "/usr/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_ app
mod = importlib.import_module(module)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/soro/soros-dashboard/wsgi.py", line 1, in <module>
from app import app
File "/home/soro/soros-dashboard/app.py", line 9, in <module>
import keycloak
File "/home/soro/soros-dashboard/keycloak.py", line 4, in <module>
from jwt.algorithms import RSAAlgorithm
ModuleNotFoundError: No module named 'jwt.algorithms'
我正在运行 Python 3.7.7.
I'm running Python 3.7.7.
推荐答案
你不应该同时安装 jwt 和 PyJWT 包,它们有一些命名空间冲突.尝试删除 jwt 包,看看它是否有效.
You shouldn’t have both the jwt and PyJWT packages installed, they have some namespace collisions. Try removing the jwt package and see if it works.
这篇关于PyJWT 不会导入 jwt.algorithms (ModuleNotFoundError: No module named 'jwt.algorithms')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!