Python3.3以上的版本通过venv模块原生支持虚拟环境,可以代替之前的virtualenv。

该venv模块提供了创建轻量级“虚拟环境”,提供与系统Python的隔离支持。每一个虚拟环境都有其自己的Python二进制(允许有不同的Python版本创作环境),并且可以拥有自己独立的一套Python包。

注意:python3.3中使用”venv”命令创建的环境不包含”pip”,需进行手动安装。Python3.4中改进了这一缺陷。

创建虚拟环境

 python -m venv myvenv

此命令会在当前目录下生成一个名为myvenv的目录,myenv也是创建的虚拟环境名。

激活环境:

/Scripts/activate.bat

退出环境:

/Scripts/deactivate.bat

附:

venv使用参数:

 usage: venv [-h] [--system-site-packages] [--symlinks] [--clear]
[--upgrade] [--without-pip] ENV_DIR [ENV_DIR ...] Creates virtual Python environments in one or more target directories. positional arguments:
ENV_DIR A directory to create the environment in. optional arguments:
-h, --help show this help message and exit
--system-site-packages Give access to the global site-packages dir to the
virtual environment.
--symlinks Try to use symlinks rather than copies, when symlinks
are not the default for the platform.
--copies Try to use copies rather than symlinks, even when
symlinks are the default for the platform.
--clear Delete the environment directory if it already exists.
If not specified and the directory exists, an error is
raised.
--upgrade Upgrade the environment directory to use this version
of Python, assuming Python has been upgraded in-place.
--without-pip Skips installing or upgrading pip in the virtual
environment (pip is bootstrapped by default)

Python3虚拟环境--venv的更多相关文章

  1. python3 虚拟环境 venv

    创建一个虚拟环境: python -m venv test            (test 为创建的虚拟环境目录) 激活虚拟环境: test\Scripts\activate            ...

  2. 关于Python3中venv虚拟环境

    Python3.3以上的版本通过venv模块原生支持虚拟环境,可以代替Python之前的virtualenv. 该venv模块提供了创建轻量级"虚拟环境",提供与系统Python的 ...

  3. day 56 linux的安装python3 ,虚拟环境,mysql ,redis

    1.1下载python源码包 网址:https://www.python.org/downloads/release/python-366/ 下载地址:https://www.python.org/f ...

  4. python3 虚拟环境配置

    CentOS7 python3 虚拟环境配置 1. 安装依赖包 yum -y install wget gcc epel-release git 2. 安装 Python3.6 yum -y inst ...

  5. python3虚拟环境应用

    python3自带虚拟环境venv,大致操作只有三步 1. 创建虚拟环境 python3 -m venv venv(名称随意) 2. 激活虚拟环境 source venv/bin/activate 3 ...

  6. Python - 虚拟环境 venv

    什么是虚拟环境 这是 Python 3.3 的新特性:https://www.python.org/dev/peps/pep-0405/ 假设自己电脑主机的 Python 环境称为系统环境,而默认情况 ...

  7. python使用虚拟环境venv

    venv模块支持使用自己的站点目录创建轻量级"虚拟环境",可选择与系统站点目录隔离.每个虚拟环境都有自己的Python二进制文件(与用于创建此环境的二进制文件的版本相匹配),并且可 ...

  8. Ubuntu安装python3虚拟环境

    大多数Linux自带python2.7,而Ubuntu1.6也自带python3.x,本文章主要记录virtualenv+vitualenvwrapper使用python3虚拟环境 虚拟环境好处不多说 ...

  9. ubantu安装python3虚拟环境

    Ubuntu安装python3虚拟环境 安装虚拟环境 步骤: 打开Linux终端(快捷键Ctrl+Alt+T),输入命令: sudo apt install python-virtualenv sud ...

随机推荐

  1. 【linux】linux系统中常见配置文件说明

    1.配置文件/proc/sys/fs/file-nr 里文件里显示三个数字 [root@localhost logs]# cat /proc/sys/fs/file-nr 已分配文件句柄的数目 已使用 ...

  2. postgresql语句

    查询oracle数据库所有表数据量 select t.table_name,t.num_rows from user_tables t ORDER BY t.num_rows desc 查询postg ...

  3. JS学习笔记Day15

    一.ES5及ES6 (一)严格模式 (二)bind/call/apply(改变上下文this指向,都是函数对象的方法) 1.bind:返回值是一个函数 2.call:返回值是一个对象 3.apply: ...

  4. 金融量化分析【day113】:聚宽自带策略

    一.策略代码 # 导入函数库 from jqdata import * # 初始化函数,设定基准等等 def initialize(context): # 设定沪深300作为基准 set_benchm ...

  5. [物理学与PDEs]第1章习题12 Coulomb 规范下电磁场的标势、矢势满足的方程

    试给出在 Coulomb 规范下, 电磁场的标势 $\phi$ 与矢势 ${\bf A}$ 所满足的方程. 解答: 真空中的 Maxwell 方程组为 $$\bee\label{1_10_12:eq} ...

  6. CF611D lcp+dp

    本篇博客只是留个辣鸡的自己标记一下,误入的同学请出门左转博客 https://blog.csdn.net/loy_184548/article/details/50865777 代码神马的也是复制啊 ...

  7. like 模糊查询

    select * from empwhere ename like '%O%' and ename like '%T%'--查询下员工姓名中有O和T的

  8. smartgit

    1.同步最新分支 2.smartgit ctrl+2 可以看到本地新增加的文件

  9. js设置document.domain实现跨域

    document.domain 只能实现跨子域的问题 如:xxx.com/a.html 和aaa.xxx.com/b.html 或:bbb,xxx.com/c.html 和ccc.xxx.com/d. ...

  10. JQuery EasyUI 初始

    基于jQuery的用户界面插件集合 1. jQuery easyui提供了一个完整的组件的集合,包括强大的DataGrid,树网格,面板.用户可以使用他们一起,或者只是用一些组件,组合和构建他想要的跨 ...