详细请看:http://masnun.com/2016/04/10/python-pyenv-pyvenv-virtualenv-whats-the-difference.html

So i see questions around these ters very often in our growing python Bangladesh community . Most of the times beginners are confused about what si what. ihope i can refer to this bload post to explain the similarities and differences.

Pyenv

Have you ever wanted to test your code against multiple versions of Python? or just wanted to install a newer version of version of Python without affecting your existing version? May be you heard about Pypy a lot and want to install it on your machine?

if you did ,then pyenv is  the perfect tool for you .It allow you to easily install multiple

copies and multiple flavors of the Python interpreter. So you can not only install different versions of Cpython,you can also install pypy,Jython,Stackless Python and their different version.

the tool provides a nice command line tool to easily swap out the global python interpreter.It also allows to define per applictions python version .You can use it`s local command or directly mention a python verison in a file named .python-version under a directory and for that directory and it`s children , the mentioned version will be used.

Trust me ,this project is awsome.I use it to switch between Python 2 and 3 on my local machine.I also use it often on severs to quickly install any flavor/version of python .Do check out their docs, you will love it .

pyvenv &virtualenv

pyvenv and virtualenv allow you to create virtual environments so we can isolate our project dependencies .Why are they helpful?Say for example ,you have one project which uses Django 1.6 still while your newer projects start with 1.9 When you install one version of DJango ,it replaces the other one ,right?virtual environments can rescue us from such situation.From the official docs:

"A virtual environment (also called a venv)is a python environment such that the python interpreter ,libraries and scripts installed into it are isolated from those installed in other virtual environments,and(by default)any libraires installed in 'system' python,i.e one which is installed as part of your opreating system."

when wen create a new virtual environment, it creates an isolated environment with it`s own local interpreter linked to it`s own libraries/script paths .so when we use this local interpreter,it loads the librares from the local environment.if it can`t find on locally,then tries to locate that library in the parent/system environment.

Please onte,these tools do not compile/install new Python interpreters, they simply create "virtual environment"on top of an installed Python version.Say,I have python 3.5 installed on my machine and created virtual environments for this version.Then these environments would also have local copies of Python3.5,except their environment paths would point to different locations, It`s like We`re copying the main interpreter to a nwe location and then making it use a different path to load libraries an packages.

virtualenv is often the most popular choice for creating the virtual environments .It has been around for a long period of time, it supports Python versions from 2.6 up to the latest 3.5 But it`s not something built into the standard Python distribution. You have to install it from the Pypi.

pyvenv comes with python stamdard distribution from version 3.4 There si also a venv module in the standard library which allows us to access this functionsanlity programmatically.We can find more details here :https//docs.python.org/3/library/venv.html.

Summary

pyenv- A python version manager.Installs different versions and flavors of Python interpreters.

pyvenv - A tool to create isolated virtual environments from a python interpreter.shops with python from 3.4

virtualenv - create virtual environment,available in Pypi.

So pyvenv is comparable to virtualenv  while pyenv is a totally different kind of tool.

转载于:https://www.cnblogs.com/wangxishan/p/6613911.html

PYTHON: PYENV, PYVENV, VIRTUALENV – WHAT’S THE DIFFERENCE?相关推荐

  1. 【Python配置】使用pyenv与virtualenv搭建单机多版本python多虚拟环境开发

    用pyenv 和 virtualenv 搭建单机多版本python 虚拟开发环境 pyenv可以帮助你在一台开发机上建立多个版本的python环境, 并提供方便的切换方法. virtualenv则提供 ...

  2. Python 学习 --->Anaconda、pyenv、virtualenv、venv

    由于 Python 的版本众多,还有 Python2 和 Python3 的争论,因此有些软件包或第三方库就容易出现版本不兼容的问题.同时在python 开发中,我们可能会遇到一种情况,就是当前的项目 ...

  3. 通过pyenv和virtualenv搭建python开发环境

    文章目录 1. 安装pyenv 1.1 部署pyenv环境 1.2 配合环境变量 2. 命令使用 2.1 安装python版本 2.2 查看当前python版本 2.3 设置版本 3. virtual ...

  4. Python pyenv

    一.简介 一般在操作系统中我们会安装多个Python版本,所以在进行Python版本切换时会比较麻烦,pyenv就提供了一种简单的方式,能简易地在多个Python版本中进行切换的工具,它简单而优雅.p ...

  5. linux 下各个工具使用(screen、tmux,pyenv、virtualenv,pip国内源,tree)

    一.多会话工具screen.tmux 两个都是多窗口工具. 1.使用后wim出现配色问题: http://ibartman.com/2014/04/16/vim%20%E9%85%8D%E8%89%B ...

  6. linux python pyenv,在Centos中安装并使用Pyenv,一个强大的Python版本管理工具

    Python发展到现在已经很强大了,各种开发相信大家都可以随心应对.但是唯独虚拟环境让人觉得很头大,不同的项目使用到的库版本不同要求我们为每一个项目创建其独一无二的环境.如果到现在你开发的项目都是基于 ...

  7. python安装虚拟环境virtualenv

    虚拟环境 虚拟环境是一个将不同项目所需求的依赖分别放在独立的地方的一个工具,它给这些工程创建虚拟的Python环境.它解决了"项目X依赖于版本1.x,而项目Y需要项目4.x"的两难 ...

  8. python编程(virtualenv环境)

    [ 声明:版权所有,欢迎转载,请勿用于商业用途. 联系信箱:feixiaoxing @163.com] 很多情况下,我们编写的代码运行在server上的时候,需要在server上安装不同的第三方包.这 ...

  9. 使用python的虚拟环境virtualenv

    技术背景 在前面几篇博客中我们介绍了容器的使用(博客1.博客2.博客3.博客4.博客5),容器是一种系统级的隔离方案,更多的强调资源上的隔离.而这里我们要介绍的python的虚拟环境,更加强调的是依赖 ...

最新文章

  1. java二分法找数数_JavaSE语言基础之数组二分法查找
  2. windows下的php的memcache扩展的安装及memcache最新下载地址
  3. Linux platform驱动模型
  4. FactoryBean 源码
  5. 我的硬盘居然被win10安装工具_安装win10无法识别硬盘,你需要这样做!网友:涨知识了...
  6. linux常用命令_Linux常用命令全称
  7. PAT_B_1012 数字分类 (有待改进)
  8. System.getProperty(属性名)方法的使用
  9. purrr | 使用map族函数进行向量化运算
  10. 西瓜书+实战+吴恩达机器学习(十二)监督学习之AdaBoost
  11. python爬虫什么意思-python的爬虫是什么意思
  12. Mysql 8.0 | #08004Client does not support authentication protocol requested by server
  13. mysql5.7审计功能开启_开启mysql的审计功能
  14. 数据结构顺序表基本操作(C/C++实现)
  15. Linux C程序实现查看文件夹大小
  16. Python Matplotlib add_subplot 和 subplots_adjust详解及代码详细说明 配图片说明
  17. android解析包时出现问题怎么解决方法,手机安装APP提示解析错误怎么办?解析包时出现问题如何解决?...
  18. 出现Only the original thread that created a view hierarchy can touch its views.的错误
  19. 大咖丨哥伦比亚教授周以真:人工智能恐慌以及大数据威胁反思
  20. Mac 下 Docker搭建RAP2 记录

热门文章

  1. 为什么现在很多公司和员工签订了合同之后都不给员工一份?
  2. 做箭步蹲的时候身体总是保持不了平衡,动作要领是什么?
  3. 收拾老家发现的老版纸币,现在还能用吗?
  4. 我一个月2000多元钱退休工资,可以完成自驾游全国的心愿吗?
  5. 父母该不该把自己的收入告诉孩子?
  6. 传说有位游客在山顶大声谈论着小孤嫁彭郎的故事
  7. 企业职工能实行弹性退休吗?
  8. 有人说,互联网电商把1000个实体店老板赚的钱,让10个互联网电商赚走了
  9. 程序员创业其实相比其他行业也有一些优势
  10. 如何把nas的功能效果最大化?