boto3 python 模块已安装,但无法加载

问题描述 投票:0回答:1

python3
pip3
通过自制程序安装。
pip3
/
pip
已安装
boto3
,并列出此模块,但无法在脚本中导入python3

$ # DEBUG INFO
$
$ which python3 pip3
/opt/homebrew/bin/python3
/opt/homebrew/bin/pip3
$
$ python3 --version ; pip3 --version
Python 3.11.6
pip 24.0 from /opt/homebrew/lib/python3.10/site-packages/pip (python 3.10)
$
$ pip3 install boto3
Requirement already satisfied: boto3 in /opt/homebrew/lib/python3.10/site-packages (1.18.36)
Requirement already satisfied: botocore<1.22.0,>=1.21.36 in /opt/homebrew/lib/python3.10/site-packages (from boto3) (1.21.65)
[...]
$
$ pip3 list | grep boto3
pip3 list | grep boto3
boto3                     1.18.36
$
$ python3
Python 3.11.6 (main, Nov  2 2023, 04:39:43) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
import boto3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'boto3'
>>> quit()
python python-3.x pip homebrew
1个回答
0
投票

您使用的是python3.11,看起来boto3保存在python3.10中

pip3 安装 boto3 已满足要求: /opt/homebrew/lib/

python3.10
/site-packages 中的 boto3 (1.18.36) 已满足要求: /opt/homebrew/lib/<1.22.0,>python3.10
/site-packages 中的 botocore
=1.21.36 (来自 boto3)(1.21.65)

python3 Python

3.11.6
(主要,2023 年 11 月 2 日,04:39:43)[Clang 14.0.3 (clang-1403.0.22.14.1)] 达尔文 输入“帮助”、“版权”、“制作人员”或“许可证”以获取更多信息。

希望这有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.