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镜像下载

    https://blog.csdn.net/qq_42570879/article/details/82853708

  2. MongoDB 高可用集群副本集+分片搭建

    MongoDB 高可用集群搭建 一.架构概况 192.168.150.129192.168.150.130192.168.150.131 参考文档:https://www.cnblogs.com/va ...

  3. VMware 设置网络

    在VMware上安装 系统完成后,设置虚拟网络 这里的VMware 版本为 14. 本文以window server 2016 为例. 在虚拟机上菜单栏中, 编辑  >> 虚拟网络编辑器 ...

  4. 第一次连接数据库mongodb踩的坑

    类型匹配错误,参数要写对了,name与age一一对应. 如果没找到错误就把异常打印出来. await person.save(function(err) { if(err) console.log(e ...

  5. sublime中编译的sass如何改变css输出风格?【这里有答案】

    由于在网上找了一遍没找到如果在sublime中将sass编译的css转换成为自己喜欢的风格,所以换了一种思路搜索到了答案,这里我将讲述如果更改. 首先sass总共有四种编译风格 (1) nested( ...

  6. MongoDB 3.6.9 集群搭建 - 切片+副本集

    1. 环境准备 在Mongo的官网下载Linux版本安装包,然后解压到对应的目录下:由于资源有限,我们采用Replica Sets + Sharding方式来配置高可用.结构图如下所示: 这里我说明下 ...

  7. [再寄小读者之数学篇](2014-05-27 矩阵的迹与 Jacobian)

    (from MathFlow) 设 $A=(a_{ij})$, 且定义 $$\bex \n_A f(A)=\sex{\cfrac{\p f}{\p a_{ij}}}. \eex$$ 试证: (1) $ ...

  8. [物理学与PDEs]第2章第2节 粘性流体力学方程组 2.5 粘性热传导流体动力学方程组的数学结构

    1.  粘性热传导流体动力学方程组可化为 $$\beex \bea \cfrac{\p \rho}{\p t}&+({\bf u}\cdot\n)\rho=-\rho \Div{\bf u}, ...

  9. 给一个Unix域套接字bind一个路径名

    #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <strings.h& ...

  10. 2.5 elif

    elif 想一想: if能完成当xxx时做事情 if-else能完成当xxx时做事情1,否则做事情2 如果有这样一种情况:当xxx1满足时做事情1:当xxx1不满足.xxx2满足时做事情2:当xxx2 ...