1

I want to get boto3 working in a python3 script. I can execute aws commands from the cli.

  1. After updating pip, it doesn't run with sudo rights unless I use the absolute path: /usr/local/bin/pip. Without sudo rights it works. I have no idea why it doesn't run under sudo, which it did before updating, as /usr/local/bin is in PATH.

  2. Should I run pip under sudo or not?

  3. I installed boto3, but still get ImportError: No module named 'boto3'. This is when I execute a script that runs python3. But it seems that boto3 is installed for python2.

Output:

$ sudo /usr/local/bin/pip install --upgrade boto3
Requirement already up-to-date: boto3 in /usr/local/lib/python2.7/site-packages

How do I get boto3 working with python3?

SPRBRN
  • 590

3 Answers3

1

Probably, the best way to deal with multiple python versions is to isolate them using virtualenv

This article covers it's basics and would give you a good overview http://docs.python-guide.org/en/latest/dev/virtualenvs/

0

If you're using ubuntu, try this out:-

sudo apt install python-boto3

Should work.

-1
brew postinstall python3

worked after a 'brew upgrade' caused this error to come up.

tkjef
  • 419