git aws.push:没有名为 boto 的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23297719/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:59:23  来源:igfitidea点击:

git aws.push: No module named boto

djangogitamazon-web-servicesamazon-elastic-beanstalkboto

提问by user2988464

i'm trying to follow the tutorial: deploy django on aws Elastic Beanstalk

我正在尝试按照教程:在 aws Elastic Beanstalk 上部署 django

when i'm doing the Step 6's substep 5:

当我在做第 6 步的第 5 步时:

git aws.push

I get a ImportError message:

我收到一条导入错误消息:

(tryhasinenv)Lee-Jamess-MacBook-Pro:tryhasin h0925473$ git aws.push
Traceback (most recent call last):
  File ".git/AWSDevTools/aws.elasticbeanstalk.push", line 21, in <module>
    from aws.dev_tools import * 
  File "/Users/h0925473/tryhasin_root/tryhasin/.git/AWSDevTools/aws/dev_tools.py", line 5, in <module>
    import boto
ImportError: No module named boto

I have no idea what to do. Can somebody tell me what's wrong?

我不知道该怎么做。有人能告诉我出了什么问题吗?

回答by Jaime Fournier

On OSX I found that pip install botodid not resolve the issue. The problem was that python was not pointing to the pip installation. export PYTHONPATH=/usr/local/lib/python2.7/site-packagesresolved this for me.

在 OSX 上,我发现这pip install boto并没有解决问题。问题是 python 没有指向 pip 安装。 export PYTHONPATH=/usr/local/lib/python2.7/site-packages为我解决了这个问题。

回答by Andy Jarrett

I solved this separately by running:

我通过运行单独解决了这个问题:

$ sudo easy_install pip

This uses the default python package installer to install PIP

这使用默认的 python 包安装程序来安装 PIP

$ sudo pip install boto 

I needed Admin rights to add boto (I don't know if thats right or not).

我需要管理员权限才能添加 boto(我不知道这是否正确)。

Then ran $ eb start

然后跑了 $ eb start

回答by Alex

Did you pip freeze > requirements.txtafter you ran pip install boto?

pip freeze > requirements.txt你跑了之后pip install boto吗?

You need to update your requirements.txtafter each time you install a new python package locally to ensure your AWS instance has all the required packages as well.

requirements.txt每次在本地安装新的 Python 软件包时,您都需要更新您的after,以确保您的 AWS 实例也具有所有必需的软件包。

EDIT:

编辑:

In case you aren't the one who wrote botoin, you'll need to install it and then pip freeze it yourself.

如果您不是写信boto的人,您需要安装它,然后自己 pip 冻结它。

Try running the following commands:

尝试运行以下命令:

pip install boto
pip freeze > requirements.txt
git add .
git commit -m "Added boto"
git aws.push

回答by Falko Menge

I had a similar issue with Ansible and fixed it using:

我在 Ansible 上遇到了类似的问题并使用以下方法修复了它:

sudo apt install python-boto