gpt4 book ai didi

python - 如何正确导入 python-keycloak

转载 作者:太空宇宙 更新时间:2023-11-03 20:18:03 25 4
gpt4 key购买 nike

我尝试在 Visual Studio 代码中使用 python-keycloak,但出现以下错误:

ModuleNotFoundError: No module named 'keycloak

我已经使用 pip 安装了该软件包:

Requirement already satisfied: python-keycloak in c:\python27\lib\site-packages (0.17.5)
Requirement already satisfied: requests>=2.20.0 in c:\python27\lib\site-packages (from python-keycloak) (2.22.0)
Requirement already satisfied: python-jose>=1.4.0 in c:\python27\lib\site-packages (from python-keycloak) (3.0.1)
Requirement already satisfied: certifi>=2017.4.17 in c:\python27\lib\site-packages (from requests>=2.20.0->python-keycloak) (2019.9.11)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\python27\lib\site-packages (from requests>=2.20.0->python-keycloak) (1.25.6)
Requirement already satisfied: idna<2.9,>=2.5 in c:\python27\lib\site-packages (from requests>=2.20.0->python-keycloak) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python27\lib\site-packages (from requests>=2.20.0->python-keycloak) (3.0.4)
Requirement already satisfied: six<2.0 in c:\python27\lib\site-packages (from python-jose>=1.4.0->python-keycloak) (1.12.0)
Requirement already satisfied: future<1.0 in c:\python27\lib\site-packages (from python-jose>=1.4.0->python-keycloak) (0.18.0)
Requirement already satisfied: rsa in c:\python27\lib\site-packages (from python-jose>=1.4.0->python-keycloak) (4.0)
Requirement already satisfied: ecdsa<1.0 in c:\python27\lib\site-packages (from python-jose>=1.4.0->python-keycloak) (0.13.3)
Requirement already satisfied: pyasn1>=0.1.3 in c:\python27\lib\site-packages (from rsa->python-jose>=1.4.0->python-keycloak) (0.4.7)

这是我尝试导入模块的行:

from keycloak import KeycloakAdmin

这正是文档中描述的,有什么我遗漏的吗?

最佳答案

python-keycloak软件包需要 python3。请尝试进入python3 shell并尝试运行:

import keycloak

如果有效,则说明您已成功安装该软件包。

问题可能出在 Visual Studio Code 使用的 Python 版本上。关注此tutorial设置正确的Python版本。

关于python - 如何正确导入 python-keycloak,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58330553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com