zoukankan      html  css  js  c++  java
  • pipPython运维日记

    一 Python 工作环境管理

    1.1 使用 pyenv 管理不同的Python 版本

    克隆项目安装

    git clone https://github.com/yyuu/pyenv.git ~/.pyenv
    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
    echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
    echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
    source ~/.bash_profile 
    
    # 验证
    [root@test1 ~]# pyenv --help
    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
       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.
    For full documentation, see: https://github.com/pyenv/pyenv#readme
    

      日常管理

     # 安装所需依赖
    yum -y install zlib*  libffi-devel openssl-devel 
    
    查看 pyenv支持的puthon版本
    pyenv install --list
    
    安装 python 3.7.3
    pyenv install -v 3.7.3
    
    查看 所有 安装的 Python版本
    pyenv versions
    
    指定切换 Python版本
    pyenv global 3.7.3
    
    删除 指定的 Python版本
    pyenv uninstall 3.7.3
    

    pip 管理

    yum install -y python-pip
    
    pip install -U pip
    
    # pip 子命令
    
    install            # 安装软件包
    download           # 下载安装包
    uninstall          # 卸载安装包
    freeze             # 按照 requirements 格式输出安装包, pip install -r requirements.txt 直接安装
    list               # 列出当前系统中的安装包
    show               # 查看 安装包的信息,包括版本,依赖,许可证,作者,主页等信息
    check              # 检查 安装包的依赖关系
    search             # 查找 安装包

    Python 启动服务器

    # python -m http.server
    

      

      

  • 相关阅读:
    英雄大乱斗
    深浅拷贝(copy)
    myleecode
    代码量简单统计
    pandas 模块 05
    matplotlib 模块 07
    KVC 和KVO浅谈
    iOS开发中懒加载的使用和限制
    关于空白模板插件的使用
    UIImageC处理
  • 原文地址:https://www.cnblogs.com/yanshicheng/p/10654691.html
Copyright © 2011-2022 走看看