简体   繁体   English

在Mac OSX 10.6.8上从usr / local / bin安全删除程序吗?

[英]Safely removing program from usr/local/bin on Mac OSX 10.6.8?

So I've been having a lot of trouble lately with a messy install of Scrapy. 所以最近我在安装Scrapy的过程中遇到了很多麻烦。 While I was learning the command line, I ended up installing with pip and then easy_install at the same time. 在学习命令行时,我最终使用pip进行安装,然后同时进行easy_install的安装。 Idk what kinda mess that made. Idk真是一团糟。

I tried the command pip uninstall scrapy , and it gave me the following error: 我尝试了命令pip uninstall scrapy ,它给了我以下错误:

OSError: [Errno 13] Permission denied: '/Library/Python/2.6/site-packages/Scrapy-0.22.0-py2.6.egg/EGG-INFO/dependency_links.txt'

so, I followed the path and deleted the text file... along with anything else that said "Scrapy" within that path. 因此,我遵循了该路径,并删除了文本文件……以及该路径中的其他任何“ Scrapy”。 There were two versions in the /site-packages/ directory. /site-packages/目录中有两个版本。

When I tried again with the pip uninstall scrapy command, I was given the following error: 当我再次尝试使用pip uninstall scrapy命令时,出现以下错误:

Cannot uninstall requirement scrapy, not installed

That felt too easy, so I went exploring through my directory hierarchy and I found the following in the usr/local/bin directory: 感觉太容易了,所以我仔细研究了目录层次结构,然后在usr/local/bin目录中找到了以下内容:

-rwxr-xr-x 1 greyelerson staff 173 Jan 21 06:57 scrapy*


Up until this point, I've resisted the urge to just delete it. 到目前为止,我一直拒绝删除它的冲动。 But I know that those folders are hidden by Apple for a reason... 但是我知道这些文件夹被Apple隐藏是有原因的...

1.) Is it safe to just delete it? 1.)删除它是否安全?

2.) Will that completely remove Scrapy, or are there more files that I need to remove as well? 2.)会完全删除Scrapy,还是还有更多需要删除的文件? (I haven't found any robust documentation on how to remove Scrapy once it's installed) (我还没有找到任何有关如何在安装Scrapy后将其删除的强大文档)

First, next time you get a Permission Denied from pip uninstall foo , try sudo pip uninstall foo rather than trying to do it manually. 首先,下次您从pip uninstall foo获得权限被拒绝时,请尝试sudo pip uninstall foo而不是尝试手动进行操作。

But it's too late to do that now, you've already erased the files that pip needs to do the uninstall. 但是现在这样做已经太迟了,您已经擦除了pip进行卸载所需的文件。


Also: 也:

Up until this point, I've resisted the urge to just delete it. 到目前为止,我一直拒绝删除它的冲动。 But I know that those folders are hidden by Apple for a reason... 但是我知道这些文件夹被Apple隐藏是有原因的...

Yes, they're hidden so that people who don't use command-line programs, write their own scripts, etc. will never have to see them. 是的,它们是隐藏的,因此不使用命令行程序,编写自己的脚本等的人将永远不必看到它们。 That isn't you. 不是你 You're a power-user, and sometimes you will need to see stuff that Apple hides from novices. 您是超级用户,有时您需要查看Apple对新手隐藏的内容。 You already looked into /Library, so why not /usr/local? 您已经研究过/ Library,为什么不使用/ usr / local?

The one thing to keep in mind is learning to distinguish stuff installed by OS X itself from stuff installed by third-party programs. 要记住的一件事是学习区分OS X本身安装的内容和第三方程序安装的内容。 Basically, anything in /System/Library or /usr is part of OS X, so you should generally not touch it or you might break the OS; 基本上,/ System / Library或/ usr中的任何内容都是OS X的一部分,因此通常不应该触摸它,否则可能会损坏OS。 anything installed in /Library or /usr/local is not part of OS X, so the worst you could do is break some program that you installed. / Library或/ usr / local中安装的任何内容都不是OS X的一部分,因此,最糟糕的事情是破坏某些已安装的程序。

Also, remember that you can always back things up. 另外,请记住,您始终可以备份内容。 Instead of deleting a file, move it to some quarantine location under your home directory. 而不是删除文件,而是将其移动到主目录下的某些隔离位置。 Then, it it turns out you made a mistake, just move it back. 然后,事实证明您犯了一个错误,只需将其移回即可。


Anyway, yes, it's safe to delete /usr/local/bin/scrapy . 无论如何,是的,删除/usr/local/bin/scrapy Of course it will break scrapy, but that's the whole point of what you're trying to do, right? 当然,它会变得一团糟,但这就是您要尝试的全部内容,对吗?

On the other hand, it's also safe to leave it there, except for the fact that if you accidentally type scrapy at a shell prompt, you'll get an error about scrapy not being able to find its modules, instead of an error about no such program existing. 另一方面,将其保留在那里也是安全的,除了以下事实:如果您在shell提示符下不小心键入了scrapy ,则会收到有关scrapy无法找到其模块的错误,而不是有关no的错误。这样的程序存在。 Well, that, and it may get in the way of you trying to re-install scrapy. 好吧,这可能会妨碍您尝试重新安装scrapy。


Anyway, what I'd suggest is this: pip install scrapy again. 无论如何,我建议的是: pip install scrapy再次。 When it complains about files that it doesn't want to overwrite, those files must be from the previous installation, so delete them, and try again. 当它抱怨不想覆盖的文件时,这些文件必须来自先前的安装,因此请删除它们,然后重试。 Repeat until it succeeds. 重复直到成功。

If at some point it complains that you already have scrapy (which I don't think it will, given what you posted), do pip install --upgrade scrapy instead. 如果在某个时候它抱怨您已经scrapy (鉴于您发布的内容,我认为这不会),请执行pip install --upgrade scrapy

If at some point it fails because it wants to update some Apple pre-installed library in /System/Library/…/lib/python, don't delete that; 如果由于某个原因它想要更新/ System / Library /…/ lib / python中的某些Apple预安装的库而导致失败,请不要删除它; instead, switch to pip install --no-deps scrapy . 相反,请切换到pip install --no-deps scrapy (Combine this with the --upgrade flag if necessary.) Normally, the --no-deps option isn't very useful; (如果需要,请使用--upgrade标志将其合并。)通常, --no-deps选项不是很有用; all it does is get you a non-working installation. 它所做的就是让您无法正常安装。 But if you're only installing to uninstall, that's not a problem. 但是,如果只安装要卸载,那不是问题。

Anyway, once you get it installed, pip uninstall scrapy , and now you should be done, all traces gone. 无论如何,一旦安装完毕,请pip uninstall scrapy ,现在应该完成了,所有痕迹都消失了。

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

相关问题 在 Mac OS 上从 usr/bin 中删除 python - Removing python from usr/bin on Mac OS 为什么PyCharm在使用Python虚拟环境时在Mac上删除/ usr / local / bin - Why is PyCharm removing /usr/local/bin on a Mac while using a Python virtual environment 自制链接python到/ usr / local / bin /在Mac上 - Homebrew link python to /usr/local/bin/ on Mac 来自/ usr / local / bin /目录的相对路径 - Relative path from the /usr/local/bin/ directory Mac上的gdb python:“ / usr / local / bin / python”错误:不在可执行格式中 - gdb python on mac: error of “/usr/local/bin/python”: not in executable format 哪个版本的程序会执行? / usr / bin中的那个或/ usr / local / bin中的那个? - which version of program will execute? the one in the /usr/bin or the one in /usr/local/bin? 为什么/ usr / local / bin在我的C ++程序中无法识别? - Why /usr/local/bin is not recognisable in my C++ program? mac osx 10.9.2上的mysql-python:错误:命令'/ usr / bin / clang'失败,退出状态为1 - mysql-python on mac osx 10.9.2: error: command '/usr/bin/clang' failed with exit status 1 如何将默认 python 从 /usr/bin/python 更改为 /usr/local/bin/python? - How to change default python from /usr/bin/python to /usr/local/bin/python? 如何将 PYTHONPATH 从 /usr/local/bin/python 更新到 /usr/bin/python - how do I update PYTHONPATH from /usr/local/bin/python to /usr/bin/python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM