gpt4 book ai didi

python - 无法导入 'keystoneauth1' ...尽管已安装?

转载 作者:行者123 更新时间:2023-12-01 06:36:48 25 4
gpt4 key购买 nike

我在MacOs上通过brew使用python3。

当我这样做的时候

> python3 -c "import keystoneauth1"

我得到:

Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'keystoneauth1'

但是然后:

> pip3 install keystoneauth1
Requirement already satisfied: keystoneauth1 in /usr/local/lib/python3.7/site-packages (3.9.0)
Requirement already satisfied: iso8601>=0.1.11 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (0.1.12)
Requirement already satisfied: os-service-types>=1.2.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.2.0)
Requirement already satisfied: stevedore>=1.20.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.28.0)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (4.1.0)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.11.0)
Requirement already satisfied: requests>=2.14.2 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (2.19.1)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (2.7)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (2018.4.16)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (1.23)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (3.0.4)

那里没有显示任何其他内容。当我验证安装时,情况看起来不错:

> pip3 show keystoneauth1
Name: keystoneauth1
Version: 3.9.0
Summary: Authentication Library for OpenStack Identity
Home-page: https://docs.openstack.org/keystoneauth/latest/
Author: OpenStack
Author-email: openstack-dev@lists.openstack.org
License: UNKNOWN
Location: /usr/local/lib/python3.7/site-packages
Requires: stevedore, requests, pbr, os-service-types, six, iso8601
Required-by: openstacksdk, keystoneauth

但如图所示,已经导入该模块不起作用。

对我来说,将brew python升级到最新版本3.7.6后问题就显现出来了。

我也明确升级了brew和pip3,但没有运气。

对于重复的拼写错误,我们深表歉意。模块名称确实是 keystoneauth1 .

最佳答案

我真的不明白这里到底发生了什么。

所以这并不是真正解释和解决问题的答案,而是对我来说有效的解决方法:

  • 首先,我强制删除了 python brew uninstall --ignore-dependencies python
  • 然后,我再次安装了它brew install python

之后,我的脚本(最终使用了该导入)再次工作,没有任何问题?!

关于python - 无法导入 'keystoneauth1' ...尽管已安装?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59627831/

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