I have trouble installing boto3 inside a virtual environment.
I have done what the document says. First I activated virtual environment. then I did a:
JavaScript
x
2
1
Sudo pip install boto3
2
Now I enter python
JavaScript
1
3
1
>> import boto3
2
ImportError: No module named boto3
3
But if I import boto, it works
JavaScript
1
4
1
>> import boto
2
>> boto.Version
3
'2.38.0'
4
Why does it install boto 2.38 when I installed boto3. I tried closing the terminal and re-opened it. Should I restart the Ubuntu machine?
Advertisement
Answer
Don’t use sudo
in a virtual environment because it ignores the environment’s variables and therefore sudo pip
refers to your global pip installation.
So with your environment activated, rerun pip install boto3
but without sudo.