卸载 python2.7 的 python.org 版本以支持默认的 OS X python2.7 [英] Uninstall python.org version of python2.7 in favor of default OS X python2.7

查看:53
本文介绍了卸载 python2.7 的 python.org 版本以支持默认的 OS X python2.7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行的是 OS X 10.8.2,我相信默认情况下它是 Python 2.7.3.我以前从 python.org 安装了 Python 2.7.2 并且想废弃它以基本上将我的系统的默认 python 重置为预安装的那个.原因是每当我启动任何 *.py 文件时,IDLE 都拒绝打开(即使指定我安装的 Python2.7.2 IDLE),我想让事情保持最新.

I'm running OS X 10.8.2 and I believe that by default this comes with Python 2.7.3. I previously had Python 2.7.2 installed from python.org and would like to scrap it to basically reset my system's default python to that which comes pre-installed. The reason being that whenever I launch any *.py file IDLE refuses to open (even when specifying my installed Python2.7.2 IDLE) and I want to get things up to date.

虽然我从不使用它,但我确实安装了 MacPorts,并且我看到它对我的 Python 路径做了很多事情 - 特别是将我的 Python 2.7 路径更改为/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}",所以我不知道这是否有区别.

Although I never use it, I do have MacPorts installed and I'm seeing that it did a bunch of stuff to my Python path - notably changing my Python 2.7 path to "/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}", so I don't know if this makes a difference.

有人可以在这里推荐一个行动方案吗?如果需要,我很乐意提供其他信息.

Can anybody recommend a course of action here? I'm happy to provide additional information if needed.

推荐答案

构成 python.org python 安装的三个部分需要删除.这些步骤对我有用:

There are three things making up the python.org python install which need to be removed. These steps worked for me:

  1. 删除实际的 Python 安装:

  1. Remove the actual Python install:

rm -rf /Library/Frameworks/Python.framework

  • 通过删除位于 /Applications/Python 2.7 的文件夹来移除 Python.org 额外应用程序:

  • Remove the Python.org extra applications by deleting the folder at /Applications/Python 2.7:

    rm -rf /Applications/Python\ 2.7
    

  • 从您的 /usr/local/bin 目录中删除指向 python 可执行文件的符号链接:

  • Remove the symlinks to the python executables from your /usr/local/bin directory:

    find /usr/local/bin -type l -and -lname "/Library/Frameworks/Python.framework*" -delete
    

  • 从您的 bash 启动脚本(~/.profile~/.bash_profile)中删除或注释掉这些行:

  • Remove or comment out these lines from your bash startup script (either ~/.profile or ~/.bash_profile):

    # Setting PATH for Python 2.7
    # The orginal version is saved in .profile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
    export PATH
    

  • 其中一些步骤可能需要超级用户权限,例如sudo.完成此操作后,您应该只拥有原始 Mac.

    Some of these steps may require super-user privileges via e.g. sudo. Once this is done, you should have only the original Mac.

    基于 http://docs.python.org/2 上的文档/using/mac.html

    这篇关于卸载 python2.7 的 python.org 版本以支持默认的 OS X python2.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆