Python3虚拟环境--venv
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的更多相关文章
- python3 虚拟环境 venv
创建一个虚拟环境: python -m venv test (test 为创建的虚拟环境目录) 激活虚拟环境: test\Scripts\activate ...
- 关于Python3中venv虚拟环境
Python3.3以上的版本通过venv模块原生支持虚拟环境,可以代替Python之前的virtualenv. 该venv模块提供了创建轻量级"虚拟环境",提供与系统Python的 ...
- day 56 linux的安装python3 ,虚拟环境,mysql ,redis
1.1下载python源码包 网址:https://www.python.org/downloads/release/python-366/ 下载地址:https://www.python.org/f ...
- python3 虚拟环境配置
CentOS7 python3 虚拟环境配置 1. 安装依赖包 yum -y install wget gcc epel-release git 2. 安装 Python3.6 yum -y inst ...
- python3虚拟环境应用
python3自带虚拟环境venv,大致操作只有三步 1. 创建虚拟环境 python3 -m venv venv(名称随意) 2. 激活虚拟环境 source venv/bin/activate 3 ...
- Python - 虚拟环境 venv
什么是虚拟环境 这是 Python 3.3 的新特性:https://www.python.org/dev/peps/pep-0405/ 假设自己电脑主机的 Python 环境称为系统环境,而默认情况 ...
- python使用虚拟环境venv
venv模块支持使用自己的站点目录创建轻量级"虚拟环境",可选择与系统站点目录隔离.每个虚拟环境都有自己的Python二进制文件(与用于创建此环境的二进制文件的版本相匹配),并且可 ...
- Ubuntu安装python3虚拟环境
大多数Linux自带python2.7,而Ubuntu1.6也自带python3.x,本文章主要记录virtualenv+vitualenvwrapper使用python3虚拟环境 虚拟环境好处不多说 ...
- ubantu安装python3虚拟环境
Ubuntu安装python3虚拟环境 安装虚拟环境 步骤: 打开Linux终端(快捷键Ctrl+Alt+T),输入命令: sudo apt install python-virtualenv sud ...
随机推荐
- 清北学堂Day3
卷积公式(Dirichlet卷积) 这个式子看上去就很变态,那么他是什么意思呢: 就是说 函数f(x)和g(x)对于n的卷积等于n的每一个因子d在f(x)上的值乘上d/n在g(x)上的值的和 例:设g ...
- 1.3浅谈Spring(IOC容器的实现)
这一节我们来讨论IOC容器到底做了什么. 还是借用之前的那段代码 ClassPathXmlApplicationContext app = new ClassPathXmlApplicationCon ...
- GO 基础
基本语法练习 打印 乘法表 package main import ("fmt") func main(){ for n:=1;n<=9;n++{ for m:=1;m< ...
- 第五节:从源码的角度理解各种Result(ActionResult、JsonResult、JavaScriptResult等)
一. 背景 提到MVC不得不说MVC中的各种Result,这些高度封装的xxxResult以及在xxxResult再度封装的xxx,大大提高了MVC框架的开发效率. 相信做过MVC开发的朋友都会用到过 ...
- 【转载】C++ vector的用法
http://www.cnblogs.com/Nonono-nw/p/3462183.html
- SpringBoot系列: Maven多项目管理
这篇是 maven 项目管理的第二篇, 讲解使用 maven 进行多个项目管理, 之前有一篇是 maven 的基础知识. SpringBoot系列: Eclipse+Maven环境准备 一个完整的解决 ...
- CentOS 7 破解root密码
破解root密码必须在本机上进行,如果使用SecureCRT Xshell等远程工具修改是会出错的! A0 哥们儿,忘记密码了,怎么办??? A1.进入启动界面: A2. 按‘e’键进入编辑模式 A ...
- 第六章 接口,lamda表达式与内部类
接口 接口可以包含常量, 且不需要publish static final修饰, 接口的域会自动添加该修饰符. Java建议不要写多余的代码,因此省略修饰符更简洁. 全部都是常量的接口背离了接口的初衷 ...
- django2.0无法加载外部css和js的问题
解决问题的思路来源于https://www.v2ex.com/t/430192 先是创建static目录,该目录与manage.py同级 然后在项目settings.py文件里添加 STATICFIL ...
- 1、Flutter_初体验_创建第一个应用_AndroidStudio_windows
1.前言 至于 Flutter 是啥,我就不在这啰嗦了,下面以 windows 为例,展示一下从安装 Flutter 到运行 APP 整个过程: 2.安装 Flutter 2.1.中文介绍文档:htt ...