简体   繁体   中英

boto3 installed yet getting ModuleNotFoundError

In an AWS Cloud9 IDE, when running

sudo pip install boto3 && sudo pip3 install --upgrade awscli && python3 permissions.py

the first two parts work fine and then in the last part I get

Traceback (most recent call last):

File "permissions.py", line 4, in

import boto3

ModuleNotFoundError: No module named 'boto3'

ModuleNotFoundError:没有名为“boto3”的模块

The permissions.py file has at the top

import boto3

If I run pip freeze can see that boto3 is installed

astroid==2.3.0
awscli==1.18.165
backcall==0.2.0
boto3==1.16.5
botocore==1.19.5
colorama==0.4.3
decorator==4.4.2
Django==2.0.2
docutils==0.15.2
git-remote-codecommit==1.15.1
ikp3db==1.4.1
importlib-metadata==2.0.0
ipython==7.16.1
ipython-genutils==0.2.0
isort==4.3.21
jedi==0.11.1
jmespath==0.10.0
lazy-object-proxy==1.5.1
mccabe==0.6.1
parso==0.1.1
pbr==5.5.1
pexpect==4.8.0
pickleshare==0.7.5
prompt-toolkit==3.0.8
ptyprocess==0.6.0
pyasn1==0.4.8
Pygments==2.7.2
pylint==2.4.4
pylint-django==2.3.0
pylint-flask==0.6
pylint-plugin-utils==0.6
python-dateutil==2.8.1
pytz==2020.1
PyYAML==5.3.1
rsa==4.5
s3transfer==0.3.3
six==1.15.0
stevedore==3.2.2
traitlets==4.3.3
typed-ast==1.2.0
urllib3==1.25.11
virtualenv==16.2.0
virtualenv-clone==0.5.4
virtualenvwrapper==4.8.4
wcwidth==0.2.5
wrapt==1.12.1
zipp==3.4.0

In order to solve it, I just changed the command to

python permissions.py

按预期完成

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM