求教关于在 osx 下安装 python3 的一个问题 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
soratadori

求教关于在 osx 下安装 python3 的一个问题

  •  
  •   soratadori Apr 16, 2016 4254 views
    This topic created in 3666 days ago, the information mentioned may be changed or developed.

    几乎没怎么用过 osx ,装个 python 就出问题了。

    按照网上的教程设置好后,输入 python ,可以正常运行 python3 了
    Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information.

    但是好像还是有问题,像输入 pydoc 或者打开 pip3 都会显示下面的错误
    -bash: /usr/bin/pydoc: /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5: bad interpreter: No such file or directory

    因为把 /Library/.../python3.5 移动到 /System/Library/.../python3.5 下面去了,所以出现错误很正常.
    我猜这个应该是环境变量的问题吧,是设置这个用户目录下的.bash_profile 这个文件(~/.bash_profile)吗,但把下面内容写进去也似乎没用

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

    头两行是注视吧,有啥意义,这个.bash_profile.pysave 的文件好像也没见啊?

    15 replies    2016-05-08 12:12:49 +08:00
    cheerzeng
        1
    cheerzeng  
       Apr 16, 2016
    我刚开始用 mac 的时候也是直接就装 python ,但这样好像容易把 mac 本身的 python 弄乱,所以建议先安装 virtualenv ,再在里面安装所需版本的 python
    pimin
        2
    pimin  
       Apr 16, 2016 via Android
    /t/269405
    供参考
    LINAICAI
        3
    LINAICAI  
       Apr 16, 2016
    不要随便动 Python ,苹果系统对他有版本依赖,用 brew 安装其他版本啊
    noli
        4
    noli  
       Apr 16, 2016
    @LINAICAI 说的是最 easy 的正道。

    你看的什么鬼教程…… 帖出来让大家鞭挞吧
    congeec
        5
    congeec  
       Apr 16, 2016
    为什么这样装 python ?
    brew install python3 不行么?
    leavic
        6
    leavic  
       Apr 16, 2016
    用 homebrew 最安全, 2.7 版的就不要去动了。
    mornlight
        7
    mornlight  
       Apr 16, 2016
    Why not pyenv ?
    soratadori
        8
    soratadori  
    OP
       Apr 16, 2016
    →_→我照你们说的去试试好了
    franklinyu
        9
    franklinyu  
       Apr 16, 2016
    搞系 Python 的一看就有癖
    skydiver
        10
    skydiver  
       Apr 17, 2016 via iPad
    因为你那个程序里写死了 python 路径吧。手动编辑一下就行了。或者删掉重新装 pip 包,让路径都是新的
    Ixizi
        11
    Ixizi  
       Apr 17, 2016
    virtualenv
    ykqmain
        12
    ykqmain  
       Apr 17, 2016 via iPhone
    我觉得没必要将 python 设为默认,很容易乱。
    要用 python3 就多输入的一个数字, python3 XXX.py , pip3 XXX 什么的,也不是很麻烦
    wzqcongcong
        13
    wzqcongcong  
       Apr 17, 2016
    pyenv~
    2zH
        14
    2zH  
       Apr 17, 2016 via Android
    brew install python3 就可以了
    fatea
        15
    fatea  
       May 8, 2016 via iPhone
    pyenv 是最实用的,多版本管理 /虚拟环境都很好。
    About     Help     Advertise     Blog     API     FAQ     Solana     2610 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 73ms UTC 12:18 PVG 20:18 LAX 05:18 JFK 08:18
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86