gpt4 book ai didi

raspberry-pi2 - 导入错误 : No module named boto3

转载 作者:行者123 更新时间:2023-12-04 05:53:41 25 4
gpt4 key购买 nike

安装 boto3 并将其升级到最新版本。我尝试了easy install pip进行安装。我安装了多个版本的 python,所以我什至尝试在 virtualenv venv 中安装。但我得到同样的错误:“没有名为 boto3 的模块”。

pip install boto3

python
Python 2.7.11 (default, Mar 10 2016, 14:12:44)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named boto3
>>>

我尝试使用/不使用 sudo:
sudo pip install boto3

我正在尝试在 Raspberry Pi 上安装 AWS SDK。
pip freeze

显示已安装“boto3==1.3.0”。
sudo pip install boto3

Requirement already satisfied (use --upgrade to upgrade): boto3 in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): botocore>=1.4.1, <1.5.0 in /usr/local/lib/python2.7/dist-packages (from boto3)
Requirement already satisfied (use --upgrade to upgrade): jmespath>=0.7.1,<1.0.0 in /usr/local/lib/python2.7/dist-packages (from boto3)
Requirement already satisfied (use --upgrade to upgrade): futures>=2.2.0,<4.0.0 in /usr/local/lib/python2.7/dist-packages (from boto3)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil>=2.1,<3.0.0 in /usr/local/lib/python2.7/dist-packages (from botocore>=1.4.1,<1.5.0->boto3)
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.10 in /usr/local/lib/python2.7/dist-packages (from botocore>=1.4.1,<1.5.0->boto3)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/local/lib/python2.7/dist-packages (from python-dateutil>=2.1,<3.0.0->botocore>=1.4.1,<1.5.0->boto3)
Cleaning up...

最佳答案

sudo pip install boto3 将其安装到您的全局 pip。此处解释:Unable to install boto3

您可以激活您的 venv,在没有 sudo 的情况下安装 boto3 并启动 python:

$ source path/to/your/ENV/bin/activate
$ pip install boto3
$ python

或者,如果您更喜欢使用全局安装,请执行以下操作:
$ deactivate
$ pip install boto3
$ python

查看 virtualenv 用户指南: https://virtualenv.pypa.io/en/latest/userguide.html

virtualenvwrapper 也使管理变得非常容易:
https://virtualenvwrapper.readthedocs.org/en/latest/install.html

关于raspberry-pi2 - 导入错误 : No module named boto3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36392806/

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