"inconsistent use of tabs and spaces in indentation" 来自 easy_install

"inconsistent use of tabs and spaces in indentation" from easy_install

今天当我尝试升级我的一些 python 应用程序(又名 pip 和 aws clt)并收到以下错误时,我遇到了一个奇怪的错误:

  File "/usr/bin/easy_install", line 31
    continue
           ^
TabError: inconsistent use of tabs and spaces in indentation

然后我尝试 运行 easy_install --version 并收到相同的错误。我的所有三台电脑(Macbook Pro、iMac 和 Mac Pro)运行 都有相同的命令,只有我的 Macbook Pro 有这个错误(并且它们都共享相同的 python 版本和应用程序)。我想知道此错误消息的可能原因。

P.S。我试图将“/usr/bin/easy_install”文件从一台计算机复制到另一台计算机并收到相同的错误消息。

我建议你上传代码。

您似乎没有使用正确的制表

类似的东西:

for i in range(0,5):
   print i
    print i**2

这真的只是我的猜测。我已经注册了 Apple Developer programer 并使用了 OS X 的 beta 测试版本。然后我关闭了开发者模式并返回到普通的 Yosemite 但有趣的是我无法使用 easy_install 之后。我觉得关掉开发者模式和关掉一样easy_install。我不完全确定这是不是真的,但你可以试一试。要么重新安装 OS X,要么重新打开开发者模式。

I am not really an expert on this so please consider this with caution ;)

我最近也 运行 遇到了这个错误,我认为这是由于有多个版本的 easy_install 和(!)多个版本的 python可用。

就我而言,我有以下可用版本:

easy_install
easy_install-2.6
easy_install-2.7
easy_install-3.4

在运行宁

之后
sudo easy_install-2.7 pip

我能够(重新)安装 pip

备注:

  • easy_install 启动 #!/usr/bin/python
  • 在我的例子中 /usr/bin/python 是指向 python
  • 3.4 版的符号链接
  • easy_install 可能是为 python 2.x 编写的,在使用 python 时失败并出现错误 "inconsistent use of tabs and spaces in indentation" 3.x