bash:pip:找不到命令

在Mac OS X上,用户在安装pip后遇到'bash: pip: command not found'的问题。尝试了安装Python 2.7和编辑PATH等方法,但未成功。解决方案包括使用setuptools安装、确保正确版本的Python运行、检查root权限以及安装Homebrew和Python 2.7。
摘要由CSDN通过智能技术生成

本文翻译自:bash: pip: command not found

I downloaded pip and ran python setup.py install and everything worked just fine. 我下载了pip并运行python setup.py install ,一切正常。 The very next step in the tutorial is to run pip install <lib you want> but before it even tries to find anything online I get an error "bash: pip: command not found". 本教程的下一步是运行pip install <lib you want>但是在尝试在线查找任何内容之前,我收到一条错误消息:“ bash:pip:not found”。

This is on Mac OS X, which I'm new too, so I'm assuming there's some kind of path setting that was not set correctly when I ran setup.py. 这是在Mac OS X上,这也是我的新手,因此我假设有些路径设置在我运行setup.py时未正确设置。 How can I investigate further? 我该如何进一步调查? What do I need to check to get a better idea of the exact cause of the problem? 我需要检查什么才能更好地了解问题的确切原因?

EDIT: I also tried installing Python 2.7 for Mac in the hopes that the friendly install process would do any housekeeping like editing PATH and whatever else needs to happy for everything to work according to the tutorials, but this didn't work. 编辑:我还尝试了为Mac安装Python 2.7,希望友好的安装过程能够完成所有工作,例如编辑PATH以及根据教程使一切正常工作所需的其他一切,但这是行不通的。 After installing is running 'python' still ran Python 2.6 and PATH was not updated. 安装运行后,“ python”仍然运行python 2.6,并且PATH未更新。


#1楼

参考:https://stackoom.com/question/f2PV/bash-pip-找不到命令


#2楼

Use setuptools to install pip : 使用setuptools安装pip

sudo easy_install pip

(I know the above part of my answer is redundant with klobucar's, but I can't add comments yet), so here's an answer with a solution to sudo: easy_install: command not found on Debian/Ubuntu: (我知道答案的上面部分对于klobucar来说是多余的,但是我还不能添加注释),所以这是sudo: easy_install: command not found解决方案的答案sudo: easy_install: command not found在Debian / Ubuntu上sudo: easy_install: command not found

sudo apt-get install python-setuptools

Also, for python3, use easy_install3 and python3-setuptools . 另外,对于python3,请使用easy_install3python3-setuptools


#3楼

I have to admit to being absolutely new to python, which I only need for one thing: awscli. 我必须承认对python绝对是新手,我只需要一件事:awscli。 I encountered this problem having downloaded python 3.xx - pip: command not found 我在下载python 3.xx时遇到了这个问题-pip:命令未找到

Whilst following the instructions for downloading the AWS cli I changed 遵循下载AWS CLI的说明后,我进行了更改

pip install awscli

to

pip3 install awscli

which ran the correct version. 运行了正确的版本。

I've made an alias on my machine to run python3 whilst typing python, which would normally run the system version 2.7. 我在计算机上做了一个别名,以在输入python的同时运行python3,这通常会运行系统版本2.7。 I'm not sure this is a good idea now. 我现在不确定这是个好主意。 I think I'll just type in the commands as they intended them to be 我想我只是按照他们想要的那样输入命令


#4楼

It might be the root permission. 它可能是root权限。 I tried exit root login, use 我尝试退出root登录,使用

sudo su -l root
pip <command>

that works for me 这对我行得通


#5楼

If you are running Python 3.5, run the following terminal command: 如果您正在运行Python 3.5,请运行以下终端命令:

sudo pip3 install -U nltk

Any other pip commands in terminal would be similar: 终端中的任何其他pip命令都将类似:

pip3 install --upgrade pip
sudo pip3 install -U numpy ::

#6楼

install Homebrew, open Terminal or your favorite OSX terminal emulator and run 安装Homebrew,打开Terminal或您喜欢的OSX终端仿真器并运行

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

insert the Homebrew directory at the top of your PATH environment variable. 将Homebrew目录插入PATH环境变量的顶部。 You can do this by adding the following line at the bottom of your ~/.profile file 您可以通过在〜/ .profile文件底部添加以下行来完成此操作

export PATH=/usr/local/bin:/usr/local/sbin:$PATH

Now, we can install Python 2.7: 现在,我们可以安装Python 2.7:

$ brew install python

Get pip repository: 获取点子存储库:

$ git clone https://github.com/pypa/pip

install pip: 安装点:

$sudo easy_install pip
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值