在 Mac 上查找并卸载 PIL

Finding and uninstalling PIL on Mac

我想安装 Pillow 并且在很多地方都读过这只有在 PIL 被删除的情况下才有效。

我在某处安装了 PIL,但我无法找到它或不记得它是如何安装的。在通过终端安装东西时,我几乎是一个 ctrl+c 和 ctrl+v 的家伙,所以我想我首先安装它时遇到了一些麻烦。

我试过了

pip uninstall PIL
easy_install uninstall PIL
brew uninstall PIL

和运行没主意了。我什至无法在聚光灯下找到名称为 "PIL" 的任何文件。

只是想找到一种方法来摆脱 PIL 并安装 Pillow,这样我就可以在几百张图片中添加文本。

运行 python El Capitan 2.7

要查找 PIL 在您机器上的位置,请使用 Python 导入它并让它打印出它的位置:

$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> import PIL
>>> PIL.__file__

在我的系统上,这给出了:

'/Library/Python/2.7/site-packages/PIL/__init__.pyc'

从这里您可以看到您的 site-packages 目录所在的位置。现在退出 python,进入 /Library/Python/2.7/site-packages/(您的确切路径可能与我的不同)并删除文件夹 PIL。那应该摆脱它。

 cd /Library/Python/2.7/site-packages/
 sudo rm -rf PIL