简体   繁体   English

如何从OSX(雪豹)手动卸载PIL

[英]How do I manually uninstall PIL from OSX (snow leopard)

I managed to manually install PIL on my macbook (without package managers, please don't answer use xcode, as I want to do this manually). 我设法在我的macbook上手动安装PIL(没有包管理器,请不要回答使用xcode,因为我想手动执行此操作)。

Unwanted answers: 不需要的答案:

  • just install xcode/pillow/ use pip /etc 只需安装xcode / pillow / use pip / etc.

The answer I am looking for could be: 我正在寻找的答案可能是:

  • a python script that will do that in your system can be found here 可以在此处找到将在您的系统中执行此操作的python脚本
  • use these terminal commands 使用这些终端命令
  • less good: the files PIL installed are here, here and here, delete them 不太好:安装PIL的文件在这里,这里和这里,删除它们

I used these commands amongst others: 我使用过这些命令:

python setup.py build
sudo python setup.py install

And I got this result: 我得到了这个结果:

--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      darwin 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
              [GCC 4.2.1 (Apple Inc. build 5646)]
--------------------------------------------------------------------
--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

My big picture problem (which I will address in another question) is that I need FREETYPE2 support, but the first step will be to uninstall PIL correctly using either a python script or the terminal. 我的大图片问题(我将在另一个问题中解决)是我需要FREETYPE2支持,但第一步是使用python脚本或终端正确卸载PIL。 My system has an intel processor and is OSX version 10.6.8 我的系统有一个intel处理器,是OSX版本10.6.8

Thanks 谢谢

There is no simple script you can run that will do this in all cases. 在任何情况下都没有可以运行的简单脚本。 (That's a large part of the reason pip was invented…) (这是pip发明的原因很大一部分......)


Apple's pre-installed Python 2.6 sets its default site-packages directory to: Apple预安装的Python 2.6将其默认的site-packages目录设置为:

/Library/Python/2.6/site-packages

… and its scripts directory to: ...及其脚本目录:

/usr/local/bin

So, sudo python setup.py install will install everything to those two directories. 所以, sudo python setup.py install会将所有内容安装到这两个目录中。

If you're using a third-party Python, or have changed the configuration, the locations may be elsewhere, so I'll refer to these as ${sitedir} and ${bindir} below. 如果您使用的是第三方Python,或者已经更改了配置,则位置可能位于其他地方,因此我将在下面将其称为$ {sitedir}和$ {bindir}。

Exactly what you get installed depends on which version of PIL or pillow you installed. 您安装的具体取决于您安装的PIL或枕头版本。 With the last few versions of PIL, it should be: 使用PIL的最后几个版本,应该是:

  • ${sitedir}/PIL $ {} sitedir / PIL
  • ${sitedir}/PIL-xyz-py2.6.egg-info $ {} sitedir /PIL-xyz-py2.6.egg-info
  • ${bindir}/pil*.py (five scripts) $ {bindir} /pil*.py(五个脚本)

Depending on the way you have setuptools and/or distribute installed, you may not have the egg-info directory. 根据安装setuptools和/或distribute安装的方式,您可能没有egg-info目录。 With Pillow, the egg-info file is named Pillow-xyz-py2.6.egg-info . 使用Pillow,egg-info文件名为Pillow-xyz-py2.6.egg-info With older PIL, you may have only four scripts instead of five. 使用较旧的PIL,您可能只有四个脚本而不是五个脚本。

Anyway, if you have the egg-info directory, look at the installed-files.txt inside of it. 无论如何,如果你有egg-info目录,请查看其中的installed-files.txt All of those files, relative to the egg-info directory itself, are what got installed. 所有这些文件,相对于egg-info目录本身,都是安装的。 However, just passing that file to rm -rf will leave behind any directories automatically created along the way—most notably, the ${sitedir}/PIL package directory. 但是,只是将该文件传递给rm -rf将留下任何自动创建的目录 - 最值得注意的是${sitedir}/PIL包目录。 You could write a script that removes each file, then removes any directories that are left empty as a result… but that could be a bad idea if, eg, you happen to have nothing else in /usr/local/bin . 可以编写一个删除每个文件的脚本,然后删除任何留空的目录......但是,如果您碰巧在/usr/local/bin没有其他任何内容,那么这可能是一个坏主意。 So, it's useful as a guide to drive or double-check manual cleanup, but it won't make everything automatic. 因此,它可以作为驱动或仔细检查手动清理的指南,但它不会使一切都自动化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM