删除与 Brew 安装位置不同的 Python 框架文件的最安全方法是什么
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22774529/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the safest way to removing Python framework files that are located in different place than Brew installs
提问by cathy.sasaki
I want to remove a Python installed in location that brew complains about, when I run brew doctor
我想删除安装在 brew 抱怨的位置的 Python,当我运行时 brew doctor
Warning:Python is installed at /Library/Frameworks/Python.framework
警告:Python 安装在 /Library/Frameworks/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 或 brewed 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 库之前,我想确保我没有遗漏任何东西。具体来说,我想删除整个 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 folderinstead of the root /Library folder.) The good, native location is here:
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
我在 Mavericks 中本地安装了 Python 2.7.5,我将使用它 - 位于下面的路径中。(不同之处在于——我相信——它放在根 /System 文件夹而不是根 /Library 文件夹中。)好的,本机位置在这里:
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
and I already installed python 3.x with brew install python3
, which put it here:
我已经用 安装了 python 3.x brew install 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/
我可以删除这些文件还是它们的后果(不必重新链接)?
/Library/Frameworks/Python.framework/
Here are steps to remove python from a stackoverflow question in 2010and a similar question here
以下是从2010 年的stackoverflow 问题和类似问题中删除 python 的步骤
Is that approach still sound? Is there anything I should be aware of?
这种方法仍然有效吗?有什么我应该注意的吗?
采纳答案by cathy.sasaki
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 版本位于此处/System/Library/Frameworks/Python.framework/Versions/2.7
(或 2.6 等),因此您可以删除任何安装在其他地方的 Python。
sudo rm -rf /System/Library/Frameworks/Python.framework/
sudo rm -rf /System/Library/Frameworks/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.
或者,根据这篇文章,你应该 brew install python 2.7 和 python 3.x,并避免在 Mavericks 中使用系统 python。
Step 2:Remove python in Applications directory (the one where all your apps are).
第 2 步:删除 Applications 目录中的 python(所有应用程序所在的目录)。
cd into folder /Applications
and ls | grep Python
to see what have.
cd 进入文件夹/Applications
,ls | grep Python
看看有什么。
Then remove:
sudo rm -rf "Python 3.3"
然后删除:
sudo rm -rf "Python 3.3"
Step 3:
第 3 步:
>>> brew prune
>>> brew prune
sample output:
示例输出:
Pruned 0 dead formula Pruned 46 symbolic links from /usr/local
修剪 0 死公式 修剪来自 /usr/local 的 46 个符号链接
Step 4:Run steps recommended by brew doctor
第 4 步:运行推荐的步骤brew doctor
sudo brew link python3
sudo brew link python3
Sample output
样本输出
Linking /usr/local/Cellar/python3/3.4.0... 19 symlinks created
链接 /usr/local/Cellar/python3/3.4.0 ... 创建了 19 个符号链接