Unable to import boto3 in python 2.7

18,287

Notice that packages are not shared between python versions. If you install a package in your python3.x local version, it doesn't mean the package will be installed in your python2.x local version...

First of all do the following:

pip freeze

If boto3 package isn't there, great! install it:

pip install boto3

if it is there then verify what pip is being used and make sure to use the pip linking to your python2.x version:

which pip

you can create a symlink to use pip for python2.7... or even better, use pyenv to manage your python versions and virtualenv to isolate your workspace for a given python version.

https://github.com/yyuu/pyenv

https://virtualenv.pypa.io/en/stable/

Share:
18,287

Related videos on Youtube

Bored Monkey
Author by

Bored Monkey

Updated on June 04, 2022

Comments

  • Bored Monkey
    Bored Monkey almost 2 years

    I've tried importing boto3 in python3 it's working, but i've tried boto3 in python2.7, it is throwing following error.

    python3
    Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:47:25)
    >>> import boto3
    >>> exit()
    $ python
    Python 2.7.10 (default, Oct 23 2015, 19:19:21)
    >>> import boto3
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: No module named boto3
    

    How we can make boto3 to work with python2.7 ?