删除与Brew安装不同位置的Python框架文件的最安全方法是什么

时间:2022-09-18 23:06:54

I want to remove a Python installed in location that brew complains about, when I run brew doctor

我想要删除一个安装在brew抱怨的地方的Python,当我运行brew医生时。

Warning: Python is installed at /Library/Frameworks/Python.framework

警告:Python安装在/Library/ framework /Python.framework上

What is the best way?

最好的方法是什么?

Here are more details / research:

以下是更多的细节/研究:

The message from the brew git website:

来自brew git网站的信息:

Important: If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team can only provide limited support.

重要提示:如果您选择安装不是这两种(系统Python或煮制Python)中的任何一种的Python,那么Homebrew团队只能提供有限的支持。

I want to make sure I am not missing anything before I remove the extra python libary. Specifically, I want to remove the entire Python.framework, those files located here. /Library/Frameworks/Python.framework/

在删除额外的python libary之前,我希望确保没有遗漏任何内容。具体地说,我想删除整个Python.framework,这些文件位于这里。/图书馆/框架/ Python.framework /

I have Python 2.7.5 installed natively with Mavericks that I'll use instead - located in the path below. (The difference being -- I believe -- that its put in the root /System folder instead of the root /Library folder.) The good, native location is here: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python

我在本地安装了Python 2.7.5,并将使用Mavericks作为替代——位于下面的路径中。(区别在于——我相信——它放在根/系统文件夹而不是根/库文件夹中。)好的本地位置在这里:/系统/库/框架/python .framework/版本/2.7/bin/python

and I already installed python 3.x with brew install python3, which put it here:

我已经安装了python 3。x与brew安装python3,把它放在这里:

==> Summary
    /usr/local/Cellar/python3/3.4.0  : 5076 files, 85M, built in 112 seconds

Can I just delete these files or are their consequences (beyond having to relink)? /Library/Frameworks/Python.framework/

我是否可以删除这些文件,或者它们的后果(除了不得不重新链接)?/图书馆/框架/ Python.framework /

Here are steps to remove python from a * question in 2010 and a similar question here

以下是将python从2010年的*问题中移除的步骤,这里还有一个类似的问题

Is that approach still sound? Is there anything I should be aware of?

这种方法还有效吗?有什么我应该知道的吗?

1 个解决方案

#1


68  

I'll self-answer. I went through steps and it's straight forward. Pycharms (the IDE I'm use) automatically found the new libraries too. Here are the steps I followed to remove the extra Python libraries on Mavericks that were not native to it and not installed by brew.

我要规范。我穿过台阶,它是直的。Pycharms(我使用的IDE)也能自动找到新的库。下面是我在Mavericks上删除额外的Python库的步骤,它们不是原生的,也不是brew安装的。

Step 1: The native Python 2.7.x version lives here /System/Library/Frameworks/Python.framework/Versions/2.7 (or 2.6, etc), so you can remove any Python that got installed elsewhere.

步骤1:本机Python 2.7。x版本在这里/系统/库/框架/Python.framework/ version /2.7(或2.6,等等),所以您可以删除安装在其他地方的任何Python。

sudo rm -rf /System/Library/Frameworks/Python.framework/

sudo rm射频/系统/图书馆/框架/ Python.framework /

Or, according to this article, you should brew install both python 2.7 and python 3.x, and avoid using system python in Mavericks.

或者,根据本文,您应该同时安装python 2.7和python 3。在Mavericks中避免使用系统python。

Step 2: Remove python in Applications directory (the one where all your apps are).

步骤2:在应用程序目录(所有应用程序所在的目录)中删除python。

cd into folder /Applications and ls | grep Python to see what have.

将cd放入文件夹/应用程序和ls | grep Python中查看有什么。

Then remove: sudo rm -rf "Python 3.3"

然后删除:sudo rm -rf“Python 3.3”

Step 3:

步骤3:

>>> brew prune

> > >酿造修剪

sample output:

样例输出:

Pruned 0 dead formula Pruned 46 symbolic links from /usr/local

从/usr/local删除了46个符号链接

Step 4: Run steps recommended by brew doctor

步骤4:运行brew doctor推荐的步骤

sudo brew link python3

sudo酿造链接python3

Sample output

样例输出

Linking /usr/local/Cellar/python3/3.4.0... 19 symlinks created

连接/usr/local/Cellar/python3/3.4.0...19日创建的符号链接

#1


68  

I'll self-answer. I went through steps and it's straight forward. Pycharms (the IDE I'm use) automatically found the new libraries too. Here are the steps I followed to remove the extra Python libraries on Mavericks that were not native to it and not installed by brew.

我要规范。我穿过台阶,它是直的。Pycharms(我使用的IDE)也能自动找到新的库。下面是我在Mavericks上删除额外的Python库的步骤,它们不是原生的,也不是brew安装的。

Step 1: The native Python 2.7.x version lives here /System/Library/Frameworks/Python.framework/Versions/2.7 (or 2.6, etc), so you can remove any Python that got installed elsewhere.

步骤1:本机Python 2.7。x版本在这里/系统/库/框架/Python.framework/ version /2.7(或2.6,等等),所以您可以删除安装在其他地方的任何Python。

sudo rm -rf /System/Library/Frameworks/Python.framework/

sudo rm射频/系统/图书馆/框架/ Python.framework /

Or, according to this article, you should brew install both python 2.7 and python 3.x, and avoid using system python in Mavericks.

或者,根据本文,您应该同时安装python 2.7和python 3。在Mavericks中避免使用系统python。

Step 2: Remove python in Applications directory (the one where all your apps are).

步骤2:在应用程序目录(所有应用程序所在的目录)中删除python。

cd into folder /Applications and ls | grep Python to see what have.

将cd放入文件夹/应用程序和ls | grep Python中查看有什么。

Then remove: sudo rm -rf "Python 3.3"

然后删除:sudo rm -rf“Python 3.3”

Step 3:

步骤3:

>>> brew prune

> > >酿造修剪

sample output:

样例输出:

Pruned 0 dead formula Pruned 46 symbolic links from /usr/local

从/usr/local删除了46个符号链接

Step 4: Run steps recommended by brew doctor

步骤4:运行brew doctor推荐的步骤

sudo brew link python3

sudo酿造链接python3

Sample output

样例输出

Linking /usr/local/Cellar/python3/3.4.0... 19 symlinks created

连接/usr/local/Cellar/python3/3.4.0...19日创建的符号链接