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]$ 
    

      

  • 相关阅读:
    JS浅拷贝和深拷贝
    使用阿里云短信服务
    autojs相关的文档地址记录和简单使用
    Linux 根目录所在分区被脏数据占满
    openstack宿主机故障,虚拟实例恢复
    openstack创建vlan网络并配置网络设备
    联想 lenove 3750 M4服务器更改启动项和管理口IP
    ansible常用方法
    Mysql数据库-多实例主从复制-主从故障详解
    Linux 系统优化-workstation实践
  • 原文地址:https://www.cnblogs.com/i-honey/p/8452725.html
Copyright © 2011-2022 走看看