zoukankan      html  css  js  c++  java
  • pyenv 配置python虚拟环境

    安装pyenv环境
    yum -y install git
    yum install gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel
    useradd python
    passwd python
    
    
    # su - python
    $ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
    PATH=$PATH:$HOME/bin
    vim ~/.bashrc  添加以下三行
    export PATH="/home/python/.pyenv/bin:$PATH"
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
    $ source ~/.bashrc
    
    
    
    python --version
    pyenv 
    python -V
    
    pyenv versions
    pyenv help install
    
    
    
    pyenv install 3.5.3
    pyenv install 3.5.3 -v
    
    $ mkdir ~/.pyenv/cache
    
    下载好的包放进去,三种压缩格式的都放进去
    
    $ pyenv versions
    * system (set by /home/python/.pyenv/version)
      3.5.3
    
    
    [python@pythonsys ~]$ pyenv 
    pyenv 1.1.3
    Usage: pyenv <command> [<args>]
    
    Some useful pyenv commands are:
       commands    List all available pyenv commands
       local       Set or show the local application-specific Python version. 当前文件夹与版本环境捆绑在一起,子目录继承
       global      Set or show the global Python version。                    改变全局版本
       shell       Set or show the shell-specific Python version              只改变当前shell的版本
       install     Install a Python version using python-build
       uninstall   Uninstall a specific Python version
       rehash      Rehash pyenv shims (run this after installing executables)
       version     Show the current Python version and its origin
       versions    List all Python versions available to pyenv
       which       Display the full path to an executable
       whence      List all Python versions that contain the given executable
    
    See `pyenv help <command>' for information on a specific command.
    
    
    
    
    $ mkdir py3.5.3
    cd py3.5.3
    [python@pythonsys ~]$ pyenv version
    system (set by /home/python/.pyenv/version)
    [python@pythonsys ~]$ pyenv versions
    * system (set by /home/python/.pyenv/version)
      3.5.3
    
    子目录继承
    
    
    会将下载的压缩包也保存在cache目录中
    [python@pythonsys .pyenv]$ pyenv install 3.6.2 -v
    [python@pythonsys .pyenv]$ ls /home/python/.pyenv/cache/
    Python-3.6.2.tar.gz
    
    
    
    [python@pythonsys cmdb]$ pyenv versions
    * system (set by /home/python/.pyenv/version)
      3.5.3
      3.6.1
      3.6.2
    [python@pythonsys cmdb]$ pyenv virtualenv 3.5.3 magedu353.    多人协作开发使用虚拟环境,避免公共目录envs混乱
    Requirement already satisfied: setuptools in /home/python/.pyenv/versions/3.5.3/envs/magedu353/lib/python3.5/site-packages
    Requirement already satisfied: pip in /home/python/.pyenv/versions/3.5.3/envs/magedu353/lib/python3.5/site-packages
    [python@pythonsys cmdb]$ pyenv version
    system (set by /home/python/.pyenv/version)
    [python@pythonsys cmdb]$ pyenv versions
    * system (set by /home/python/.pyenv/version)
      3.5.3
      3.5.3/envs/magedu353
      3.6.1
      3.6.2
      magedu353
    [python@pythonsys cmdb]$ pyenv local magedu353
    (magedu353) [python@pythonsys cmdb]$ pyenv version
    magedu353 (set by /home/python/magedu/project/cmdb/.python-version)
    (magedu353) [python@pythonsys cmdb]$ pyenv versions
      system
      3.5.3
      3.5.3/envs/magedu353
      3.6.1
      3.6.2
    * magedu353 (set by /home/python/magedu/project/cmdb/.python-version)
    (magedu353) [python@pythonsys cmdb]$ 
    

      

  • 相关阅读:
    JBPM使用
    eclipse spring3.X redis 整合-配置
    30分钟学会如何使用Shiro
    Linux下环境变量配置方法梳理(.bash_profile和.bashrc的区别)
    Eclipse上Maven环境配置使用 (全)
    redis未设置idle超时时间导致连接过多
    linux下搭建redis并解决无法连接redis的问题
    redis配置用户认证密码
    spring配置redis
    Linux nohup和&后台运行,进程查看及终止,进程信息输出,控制台信息输出
  • 原文地址:https://www.cnblogs.com/i-honey/p/8452725.html
Copyright © 2011-2022 走看看