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
Ferrix
V2EX  ›  Python

Mac 中同时有三个版本的 Python , 2.7、3.5 和 3.6,但是 terminal 中无法使用 3.5,而 Pycharm 却可以,请问这是为什么?

  •  
  •   Ferrix · 2017-05-05 07:52:50 +08:00 · 4203 次点击
    这是一个创建于 2794 天前的主题,其中的信息可能已经有所发展或是发生改变。
    18 条回复    2017-05-23 09:53:06 +08:00
    kindjeff
        1
    kindjeff  
       2017-05-05 07:58:29 +08:00 via iPhone
    不能用是什么意思,你敲 python3.5 回车没反应,还是切到 python3.5 的目录运行不了?
    zsz
        2
    zsz  
       2017-05-05 08:03:55 +08:00 via iPhone   ❤️ 1
    终端下切到 python3.5 安装位置,手动运行下看看


    加我们的群问效率更高,一群工程师组建的面向初学者的
    Python Linux 学习群,qq 群号:278529278,
    Php Linux 学习群,qq 群号:476648701,
    非商业性质,拒绝广告,只接收真正想学这方面技术的朋友,交流学习,申请请说明来自 v2ex
    zhaojjxvi
        3
    zhaojjxvi  
       2017-05-05 08:04:43 +08:00 via iPhone
    Pycharm 也不自带 Python3 啊,应该是你给配的环境变量啊什么的用的 3.5
    KeepPro
        4
    KeepPro  
       2017-05-05 08:08:45 +08:00 via Android   ❤️ 1
    ide 配置的绝对路径,终端里面你也用全路径就行
    arischow
        5
    arischow  
       2017-05-05 08:18:33 +08:00 via iPhone
    pyenv
    Tink
        6
    Tink  
       2017-05-05 08:38:07 +08:00 via iPhone
    环境变量的问题吧
    LokiSharp
        7
    LokiSharp  
       2017-05-05 08:58:11 +08:00   ❤️ 1
    cd bin
    mv python python.bak
    ln -s pythonXY python

    在 bin 里面的 python* 全都是以软连接的形式存在的 想要改 python 版本自己重建软连接就行了。
    zhengxiaowai
        8
    zhengxiaowai  
       2017-05-05 10:36:32 +08:00
    环境变量问题
    richardma
        9
    richardma  
       2017-05-05 20:34:55 +08:00
    为何不用 virtualenv ?
    Ferrix
        10
    Ferrix  
    OP
       2017-05-06 08:07:05 +08:00
    @kindjef

    ~ python3.5
    zsh: command not found: python3.5
    Ferrix
        11
    Ferrix  
    OP
       2017-05-06 08:08:32 +08:00
    @zhaojjxvi 恩,PyCharm 可以选择 project interpreter,因为之前很多包都装在了 3.5 中
    Ferrix
        12
    Ferrix  
    OP
       2017-05-06 08:09:25 +08:00
    @KeepPro 恩,我试试
    Ferrix
        13
    Ferrix  
    OP
       2017-05-06 08:16:10 +08:00
    @arischow 谢谢
    Ferrix
        14
    Ferrix  
    OP
       2017-05-06 08:17:35 +08:00
    昨天有事没用电脑,多谢各位的热心解答
    LokiSharp
        15
    LokiSharp  
       2017-05-06 09:28:22 +08:00 via iPhone
    @Ferrix 应该是 python35 不带点的,你去 /bin 看看就知道了
    LokiSharp
        16
    LokiSharp  
       2017-05-06 09:31:40 +08:00 via iPhone
    @LokiSharp 不对。。。是带点的。。。
    LokiSharp
        17
    LokiSharp  
       2017-05-06 09:34:58 +08:00 via iPhone   ❤️ 1
    $ ll python*
    lrwxrwxrwx 1 root root 7 Jan 17 21:24 python -> python2
    lrwxrwxrwx 1 root root 9 Jan 17 21:24 python2 -> python2.7
    -rwxr-xr-x 1 root root 7136 Nov 6 08:29 python2.7
    -rwxr-xr-x 1 root root 1835 Nov 6 08:29 python2.7-config
    -rwxr-xr-x 1 root root 304 Dec 13 19:49 python2.7-futurize
    -rwxr-xr-x 1 root root 308 Dec 13 19:49 python2.7-pasteurize
    lrwxrwxrwx 1 root root 16 Jan 17 23:28 python2-config -> python2.7-config
    -rwxr-xr-x 1 root root 11312 Dec 29 09:58 python3
    -rwxr-xr-x 2 root root 11312 Nov 10 00:27 python3.4
    -rwxr-xr-x 2 root root 11312 Nov 10 00:27 python3.4m
    -rwxr-xr-x 2 root root 11312 Apr 7 22:35 python3.6
    -rwxr-xr-x 2 root root 11312 Apr 7 22:35 python3.6m
    lrwxrwxrwx 1 root root 9 Jan 17 23:31 python3.bak -> python3.4
    lrwxrwxrwx 1 root root 14 Jan 17 23:28 python-config -> python2-config
    xray887
        18
    xray887  
       2017-05-23 09:53:06 +08:00
    ➜ /Users/xray887 >which python
    /usr/local/bin/python
    ➜ /Users/xray887 >cd /usr/local/bin
    ➜ /usr/local/bin >ll python*
    lrwxr-xr-x 1 xray887 admin 34B 12 28 20:45 python -> ../Cellar/python/2.7.13/bin/python
    lrwxr-xr-x 1 xray887 wheel 71B 11 26 2015 python-32 -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python-32
    lrwxr-xr-x 1 xray887 admin 41B 12 28 20:45 python-config -> ../Cellar/python/2.7.13/bin/python-config
    lrwxr-xr-x 1 xray887 admin 35B 12 28 20:45 python2 -> ../Cellar/python/2.7.13/bin/python2
    lrwxr-xr-x 1 xray887 wheel 72B 11 26 2015 python2-32 -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python2-32
    lrwxr-xr-x 1 xray887 admin 42B 12 28 20:45 python2-config -> ../Cellar/python/2.7.13/bin/python2-config
    lrwxr-xr-x 1 xray887 admin 37B 12 28 20:45 python2.7 -> ../Cellar/python/2.7.13/bin/python2.7
    lrwxr-xr-x 1 xray887 wheel 74B 11 26 2015 python2.7-32 -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-32
    lrwxr-xr-x 1 xray887 admin 44B 12 28 20:45 python2.7-config -> ../Cellar/python/2.7.13/bin/python2.7-config
    lrwxr-xr-x 1 xray887 admin 35B 4 28 10:06 python3 -> ../Cellar/python3/3.6.1/bin/python3
    lrwxr-xr-x 1 xray887 wheel 72B 11 13 2015 python3-32 -> ../../../Library/Frameworks/Python.framework/Versions/3.5/bin/python3-32
    lrwxr-xr-x 1 xray887 admin 42B 4 28 10:06 python3-config -> ../Cellar/python3/3.6.1/bin/python3-config
    lrwxr-xr-x 1 xray887 wheel 74B 11 13 2015 python3.5-32 -> ../../../Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5-32
    lrwxr-xr-x 1 xray887 admin 37B 4 28 10:06 python3.6 -> ../Cellar/python3/3.6.1/bin/python3.6
    lrwxr-xr-x 1 xray887 admin 44B 4 28 10:06 python3.6-config -> ../Cellar/python3/3.6.1/bin/python3.6-config
    lrwxr-xr-x 1 xray887 admin 38B 4 28 10:06 python3.6m -> ../Cellar/python3/3.6.1/bin/python3.6m
    lrwxr-xr-x 1 xray887 admin 45B 4 28 10:06 python3.6m-config -> ../Cellar/python3/3.6.1/bin/python3.6m-config
    lrwxr-xr-x 1 xray887 admin 35B 12 28 20:45 pythonw -> ../Cellar/python/2.7.13/bin/pythonw
    lrwxr-xr-x 1 xray887 wheel 72B 11 26 2015 pythonw-32 -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw-32
    lrwxr-xr-x 1 xray887 admin 36B 12 28 20:45 pythonw2 -> ../Cellar/python/2.7.13/bin/pythonw2
    lrwxr-xr-x 1 xray887 wheel 73B 11 26 2015 pythonw2-32 -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2-32
    lrwxr-xr-x 1 xray887 admin 38B 12 28 20:45 pythonw2.7 -> ../Cellar/python/2.7.13/bin/pythonw2.7
    lrwxr-xr-x 1 xray887 wheel 75B 11 26 2015 pythonw2.7-32 -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7-32
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2673 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 15:08 · PVG 23:08 · LAX 07:08 · JFK 10:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.