mac pyenv virtualenv 2.7.11 3.5.2 多版本共存

reference :https://github.com/yyuu/pyenv-installer       

1.首先安装pyenv 

        这里推荐bash安装方式,使用brew总会提示各种权限,link。

        

        url -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

<!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->
 
       配置mac环境变
       # Load pyenv automatically by adding
       # the following to ~/.bash_profile:

       export PATH="/Users/admin/.pyenv/bin:$PATH"
        eval "$(pyenv init -)
       更新升级pyenv
        pyenv update 
 
           pycharm指定python 版本
           pyenv virtualenv 3.5.2 app 
  1. 创建之后的目录结构为

    .pyenv  pwd
    /Users/jerry/.pyenv
    ☁  .pyenv  tree -d -L 4
    .
    ├── cache
    ├── plugins
    │   └── pyenv-virtualenv
    │       ├── bin
    │       ├── etc
    │       │   └── pyenv.d
    │       ├── shims
    │       └── test
    │           ├── stubs
    │           └── tmp
    ├── shims
    └── versions
        ├── 3.5.1
        │   ├── bin
        │   ├── envs
        │   │   ├── my-virtualenv-3.5.1
        │   │   └── new-env-3.5.1
        │   ├── include
        │   │   └── python3.5m
        │   ├── lib
        │   │   ├── pkgconfig
        │   │   └── python3.5
        │   └── share
        │       └── man
        ├── my-virtualenv-3.5.1 -> /Users/jerry/.pyenv/versions/3.5.1/envs/my-virtualenv-3.5.1
        └── new-env-3.5.1 -> /Users/jerry/.pyenv/versions/3.5.1/envs/new-env-3.5.1
    
    26 directories
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
  2. 在PyCharm中为工程选择Project Interpreter

    PyCharm->Perferences->Project->Project Interperter

    这里写图片描述

    在弹出窗口中,点左下角的+号,add local,然后输入路径 
    /Users/jerry/.pyenv/versions/3.5.1/envs/new-env-3.5.1/bin/python -> 点击OK即为工程设置好相应环境的python解释器了。

    这里写图片描述

 

猜你喜欢

转载自hugoren.iteye.com/blog/2327360
今日推荐