我下载了pip并运行python setup.py install,一切正常。本教程的下一步是运行pip install <lib,你想要>,但在它尝试在线查找任何东西之前,我得到一个错误“bash: pip: command not found”。

这是在Mac OS x上,我假设在运行setup。py时,某种路径设置没有正确设置。我如何进一步调查?我需要检查什么才能更好地了解问题的确切原因?

编辑:我还尝试了为Mac安装Python 2.7,希望友好的安装过程会做一些管理工作,比如编辑PATH和任何其他需要发生的事情,以便根据教程工作,但这并不管用。安装后,运行'python'仍然运行python 2.6, PATH没有更新。


当前回答

我下载python 3.x时遇到了这个问题。正在安装awscli - pip:命令未找到。

在按照说明下载AWS客户端时,我改变了

pip install awscli

to

pip3 install awscli

运行正确的版本。

我在我的机器上创建了一个别名,在输入python时运行python3,这通常会运行系统版本2.7。我现在不确定这是个好主意。我想我就按他们想要的那样输入命令。

其他回答

安装Python的最新版本

它有很多下载链接,比如numpy和scipy

进入终端,输入如下命令:—

sudo easy_install pip

对于Python安装包,请检查此选项

Requirements for Installing Packages This section describes the steps to follow before installing other Python packages. Install pip, setuptools, and wheel If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from python.org, you will already have pip and setuptools, but will need to upgrade to the latest version: On Linux or OS X: pip install -U pip setuptools On Windows: python -m pip install -U pip setuptools If you’re using a Python install on Linux that’s managed by the system package manager (e.g “yum”, “apt-get” etc…), and you want to use the system package manager to install or upgrade pip, then see Installing pip/setuptools/wheel with Linux Package Managers Otherwise: Securely Download get-pip.py 1 Run python get-pip.py. 2 This will install or upgrade pip. Additionally, it will install setuptools and wheel if they’re not installed already.

CentOS 7用户只需使用:

yum install python-pip

如果您正在使用pip,也建议使用virtualenv。添加方法如下:

yum install python-virtualenv

我也遇到过类似的问题。我卸载了pip3,然后重新安装:

卸载:

sudo apt-get remove python3-pip

重新安装:

sudo apt-get install python3-pip

这对我来说很有用:)

解决:

将这一行添加到~/.bash_profile: 导出路径= " / usr /地方/ bin:美元路径” 在终端窗口中运行 源~ / . bash_profile

对于还没有激活venv For aws cli的新用户,请尝试一下 “源venv/scripts/activate”然后尝试 "pip install awscli"