JavaEar 专注于收集分享传播有价值的技术资料

ImportError:没有名为boto3的模块 (ImportError: No module named boto3)

Installed the boto3 and upgraded it to the latest release. I tried the easy install pip for installation. I have multiple versions of python installed so I even tried installing in virtualenv venv. But I get the same error: "No module named 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
>>>

I tried with / without sudo:

sudo pip install boto3

I`m trying to install AWS SDK on Raspberry Pi.

pip freeze

shows "boto3==1.3.0" installed.

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...

3个回答

    最佳答案

  1. 英文原文

    sudo pip install boto3 installs it to your global pip. Explained here: Unable to install boto3

    You can activate your venv, install boto3 without sudo and start python:

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

    Or if you prefer to use your global installation do:

    $ deactivate
    $ pip install boto3
    $ python
    

    Check out the virtualenv user guide: https://virtualenv.pypa.io/en/latest/userguide.html

    Also virtualenvwrapper makes it really easy to manage: https://virtualenvwrapper.readthedocs.org/en/latest/install.html


    中文翻译

    sudo pip install boto3将它安装到您的全球点。在此处解释:无法安装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/烯/最新/ userguide.html

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

    sudo pip install boto3 installs it to your global pip. Explained here: Unable to install boto3

    You can activate your venv, install boto3 without sudo and start python:

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

    Or if you prefer to use your global installation do:

    $ deactivate
    $ pip install boto3
    $ python
    

    Check out the virtualenv user guide: https://virtualenv.pypa.io/en/latest/userguide.html

    Also virtualenvwrapper makes it really easy to manage: https://virtualenvwrapper.readthedocs.org/en/latest/install.html

    sudo pip install boto3将它安装到您的全球点。在此处解释:无法安装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/烯/最新/ userguide.html

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

  2. 参考答案2
  3. Globally for my mac, this worked

    sudo pip install --ignore-installed six boto3
    
  4. 参考答案3
  5. I have faced the same issue and also not using virtual environment. easy_install is working for me. I am using Ubuntu 16.04 and my python version is 2.7

    easy_install boto3