V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
tanteng
V2EX  ›  Python

如何在 mac 下把系统默认的 python2.7 版本切换成 3.4?

  •  
  •   tanteng ·
    tanteng · 2015-05-06 23:26:10 +08:00 · 10578 次点击
    这是一个创建于 3277 天前的主题,其中的信息可能已经有所发展或是发生改变。


    如图,我在官网下载了最新的python 3.4版本并且安装成功,在终端输入python --version显示系统默认的python版本还是2.7,虽然输入python3就可以切换到3.4版本,但是下次打开终端实际上还是默认的python2.7,怎么在mac下切换python版本呢?

    或者说根本不需要切换?
    6 条回复    2015-05-07 16:34:02 +08:00
    Sylv
        1
    Sylv  
       2015-05-06 23:33:43 +08:00 via iPhone   ❤️ 1
    不需要切换,要用 Python 3 就输 python3
    要知道 Python 2 和 3 不兼容,你要是把系统自带且依赖的 Python 2 改成了 3,可能会出现奇怪的问题的
    neoblackcap
        2
    neoblackcap  
       2015-05-06 23:35:42 +08:00
    默认python?即终端下面python命令的指向?
    直接建个符号链接到/usr/local/bin里面如何?/usr/local/bin的搜索顺序一般优先于/usr/bin,可以实现无痛替代,要换回来也简单,直接将符号链接删掉
    Delbert
        3
    Delbert  
       2015-05-06 23:41:12 +08:00
    善用搜索。网上一堆教程。
    除了现在没有pythonw以外,教程仍旧适用。
    Syec
        4
    Syec  
       2015-05-06 23:42:52 +08:00
    最好把python2和python3当作两种语言来看,不然有够受的
    staticor
        5
    staticor  
       2015-05-06 23:43:38 +08:00
    可以用pyenv 或 virtualenv之类的多版本管理.
    imn1
        6
    imn1  
       2015-05-07 16:34:02 +08:00
    虽然不懂mac,但估计换完之后很多第三方软件报废
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5535 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 06:36 · PVG 14:36 · LAX 23:36 · JFK 02:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.