安装后未将awscli添加到路径 [英] awscli not added to path after installation

查看:98
本文介绍了安装后未将awscli添加到路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据亚马逊的官方指示安装了aws cli.

I installed the aws cli according to the offical Amazon directions.

sudo pip install awscli

但是,在我的路径中找不到aws.安装似乎已成功. /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/awscli中有许多文件,但是没有名为aws的可执行文件.我的python版本是3.3.4,我的pip版本是1.5.4,并在OS X 10.9上运行此命令.有什么问题吗?

However, aws is nowhere to be found in my path. The installation seems to have been successful. There are a number of files located at /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/awscli, however there are no executables named aws. My python version is 3.3.4, my pip version is 1.5.4, and running this command on OS X 10.9. What could be wrong?

谢谢!

推荐答案

改进OP的答案

OP回答了他们自己的问题,但是可执行文件的确切位置与其相同的可能性更大.因此,让我们解释一下为什么他的解决方案有效,以便您可以将其应用于自己.

Improving the OP's Answer

The OP answered their own question, but the exact location of the executable is more likely to be different than it is to be the same. So, let's break down WHY his solution worked so you can apply it to yourself.

位于/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/awscli的文件很多,但是没有名为aws的可执行文件.

There are a number of files located at /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/awscli, however there are no executables named aws.

解决方案

解决方案是将/Library/Frameworks/Python.framework/Versions/3.3/bin添加到我的PATH.

The solution was to add /Library/Frameworks/Python.framework/Versions/3.3/bin to the my PATH.

让我们学点东西

比较这些路径以找到它们的共性:

Let's learn something

Compare those paths to find their commonality:

/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/awscli
/Library/Frameworks/Python.framework/Versions/3.3/bin

请注意,它们在libbin处有所不同.并考虑到OP指出:"没有名为aws的可执行文件.",这使我们进入了第一门学习课程:

Notice that they diverge at lib vs. bin. And consider that the OP stated, "there are no executables named aws." That brings us to our first learning lessons:

  • 可执行文件通常不在lib文件夹中.
  • 寻找具有共同血统的bin文件夹.
  • Executables tend to not be in lib folders.
  • Look for bin folders that share a common lineage.

在这种情况下,我建议通过以下方式查找bin文件夹:

In this case I would have suggested looking for bin folders via:

find /Library/Frameworks/Python.framework -type d -name bin

但是,如果要执行此操作,则最好通过以下方法搜索可执行文件:

But, if you are going to do that, you might as well just search for your executable via:

find /Library/Frameworks/Python.framework -type f -perm -100 -name aws
# the `-` in `perm -100` means not an exact match of 100
# but any octal that includes 100

但是等等

OP如何知道如何查看其/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/?

最简单的答案也是我们的下一课:

The easiest answer is also our next learning lesson:

  • 询问您的python安装位置.

这是我的操作方式:

$ python -c 'import awscli; print(awscli)'
<module 'awscli' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/__init__.pyc'>

$ python3 -c 'import awscli; print(awscli)'
<module 'awscli' from '/System/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/awscli/__init__.py'>

我有2个Python,它们都不使用与OP相同的路径或什至路径模式.

I have 2 Pythons and neither of them use the same paths or even path patterns as the OP.

$ find /System/Library/Frameworks/Python.framework -type d -name bin
/System/Library/Frameworks/Python.framework/Versions/2.7/bin
/System/Library/Frameworks/Python.framework/Versions/3.6/bin

$ find /System/Library/Frameworks/Python.framework -type f -perm -100 -name aws
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/aws
/System/Library/Frameworks/Python.framework/Versions/3.6/bin/aws

如您所见,我有2个bin文件夹和2个aws可执行文件.我可能想使用Python3.6版本.但是,如果我正在为使用Python2.7版本的远程系统进行本地试验和错误测试,那么我将要使用它.这就是为什么我安装了2个版本的原因.

As you can see, I have 2 bin folders and 2 aws executables. I probably want to use the Python3.6 version. However, if I'm doing local trial and error work for a remote system that uses the Python2.7 version, I'm going to want to use that. And this is exactly why I have 2 version installed.

这篇关于安装后未将awscli添加到路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆