Python AWS aws.push ImportError:Ubuntu 中没有名为 boto 的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23365374/
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-08-19 02:50:35  来源:igfitidea点击:

AWS aws.push ImportError: No module named boto in Ubuntu

pythonubuntuamazon-web-servicesamazon-elastic-beanstalk

提问by Rober

I'm trying to follow this tutorial: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html

我正在尝试遵循本教程:http: //docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html

in order to deploy a Ruby on Rails app in AWS with Ubuntu.

为了在 AWS 中使用 Ubuntu 部署 Ruby on Rails 应用程序。

Everything went ok (I can run my app in local), until the final step. When I run aws.push I get next error.

一切顺利(我可以在本地运行我的应用程序),直到最后一步。当我运行 aws.push 时,出现下一个错误。

   roberto@ubuntu:~/dev/myapp$ git aws.push
Traceback (most recent call last):
  File ".git/AWSDevTools/aws.elasticbeanstalk.push", line 21, in <module>
    from aws.dev_tools import * 
  File "/home/roberto/dev/myapp/.git/AWSDevTools/aws/dev_tools.py", line 5, in <module>
    import boto
ImportError: No module named boto

I have read this post git aws.push: No module named botoand run:

我已经阅读了这篇文章git aws.push: No module named boto并运行:

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

But still the same result.

但结果还是一样。

UPDATE:I think the problem is related to my python versions. When I run which pythonI get /usr/bin/python. If I do ls this folder I see python, python2, python2.7, python3, python3.4.

更新:我认为问题与我的 python 版本有关。当我运行时,which python我得到 /usr/bin/python。如果我执行 ls 这个文件夹,我会看到 python、python2、python2.7、python3、python3.4。

When I run pythonI get:

当我运行时,python我得到:

Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

I don't know what to do.

我不知道该怎么办。

The problem was the first boto installation it didn't work due to permissions problems, and I didn't realize. I ran sudo pip install botoand everything went OK this time.

问题是第一次安装 boto 由于权限问题而无法正常工作,我没有意识到。我跑了sudo pip install boto,这次一切正常。

采纳答案by Rober

See my own comments in the post above.

在上面的帖子中查看我自己的评论。

回答by Diego Milán

What happened is that the eb command line interface available in that specific AWS tutorial (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html) does not provide the latest version of boto.

发生的情况是该特定 AWS 教程 ( http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html) 中提供的eb 命令行界面不提供最新版本的 boto。

When you did

当你做

pip install boto

you installed the latest version from https://github.com/boto/botowhich solved the issue.

您从https://github.com/boto/boto安装了解决该问题的最新版本。

回答by Michael Connor

Make sure when you install Python modules that you look at the output to verify that the install happened properly. On Mac/Linux I had to run sudo to get boto to install properly.

确保在安装 Python 模块时查看输出以验证安装是否正确进行。在 Mac/Linux 上,我必须运行 sudo 才能正确安装 boto。

sudo pip install boto

回答by Stone

If on OSX w/o pip installed:

如果在没有安装 pip 的 OSX 上:

sudo easy_install pip
sudo pip install boto

回答by AKS

Doing these 3 steps helps in cases there are any error with installing pip/python first.

如果首先安装 pip/python 出现任何错误,执行这 3 个步骤会有所帮助。

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py 
$ sudo pip install boto

Or if you are on Mac, then you can try installing Python3.

或者,如果您使用的是 Mac,那么您可以尝试安装 Python3。

https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.6.pkgthen, Install it (UI way if you want to).

https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.6.pkg然后,安装它(UI 方式,如果你想的话)。

$ sudo pip3 install boto

回答by Atakan E.

If you are still having issues after downloading boto, make sure your script is able to reach your site-packages by defining the PYTHONPATH environment variable.

如果您在下载 boto 后仍然遇到问题,请确保您的脚本能够通过定义 PYTHONPATH 环境变量来访问您的站点包。

export PYTHONPATH=/usr/local/lib/python2.7/site-packages

回答by Sid Mhatre

I had face same issue with botoinstallation on Mac OS High Sierra :

boto在 Mac OS High Sierra 上安装时遇到了同样的问题:

botorequired PYTHONPATHto be set in system. First install boto :

boto需要PYTHONPATH在系统中设置。首先安装 boto :

sudo pip install boto

After installation it will return path where botois installed in logs. Use same path to add export as PYTHONPATH

安装后,它将返回boto安装在日志中的路径。使用相同的路径添加导出PYTHONPATH

Requirement already satisfied: boto in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2.48.0)

要求已经满足:boto in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2.48.0)

export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages

After adding PYTHONPATHpython will able to detect botomodule in system.

添加PYTHONPATHpython后将能够检测boto系统中的模块。