美文网首页
一、Mac Python 环境配置

一、Mac Python 环境配置

作者: faterman | 来源:发表于2018-08-31 15:53 被阅读39次

    1.mac本身自带 python 2.7.15

    ➜  ~ python --version
    Python 2.7.15
    

    2.通过homebrew安装 python3

    ➜  ~ brew install python3
    

    3.CPython是官方的一个python的解释其,装了环境就有了,通过终端启动,exit()退出。

    ➜  ~ python
    Python 2.7.15 (default, Jun 17 2018, 12:46:58)
    [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()
    ➜  ~
    

    4.如何切换环境,不同的python命令程序在不同的bin目录下,如果要使用python 2

    ➜  ~ python2
    Python 2.7.15 (default, Jun 17 2018, 12:46:58)
    [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> print('hello world')
    hello world
    >>>
    

    5.如果要使用python3

    ➜  ~ python3
    \Python 3.7.0 (default, Aug 22 2018, 15:22:33)
    [Clang 9.1.0 (clang-902.0.39.2)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> print('hello world')
    hello world
    >>>
    

    相关文章

      网友评论

          本文标题:一、Mac Python 环境配置

          本文链接:https://www.haomeiwen.com/subject/zzaswftx.html