python多版本环境控制及虚拟环境

    xiaoxiao2021-04-18  43

    python 开发的时候我们进程会遇到应为版本问题带来的困扰,以及多版本包带来的软件冲突的问题:

    下面我们来使用pyenv 和Virtualenv来为各个不同项目搭建不同环境

    一、pyenv安装

    1、选择安装到$HOME/.pyenv目录(相对目录的问题这里就不再解释)

    git clone https://github.com/yyuu/pyenv.git ~/.pyenv

    2、配置环境变量

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile

    3、重启你得当前shell使其更改生效

    exec $SHELL source ~/.bash_profile

    4、pyenv命令

    [root@yl-testing-env ~]# pyenv

    pyenv 1.0.10

    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

    转载请注明原文地址: https://ju.6miu.com/read-674506.html

    最新回复(0)