当前位置:网站首页>virtualenv和pipenv安装
virtualenv和pipenv安装
2022-07-02 06:22:00 【bthtth】
一 virtualenv 安装 windows版本
1 安装
(1)、pip install virtualenv
(2)、pip install virtualenvwrapper-win
(3)、随便找个盘,创建存放虚拟环境的目录,目录名为.env 或者.virtualenv 。前面有一个英文句号
(4)、添加环境变量 变量名 WORKON_HOME ,值 为上一步创建的完整目录
2 virtualenv的使用
(1) 、 workon 查看有多少的虚拟环境,会列出已经创建的虚拟环境名称
(2)、workon+环境名称, 进入该虚拟环境
(3)、创建虚拟环境,kmvirtualenv -p python名称 虚拟环境的名称.会在.virtualenv目录下创建一个虚拟环境
(4)、删除虚拟环境,rm 虚拟环境的名称
(5)、pip install +包名称 进入虚拟环境后,使用该命令完成包的安装
(6)、pip uninstall + 包名称A 卸载包.需要注意的是,如果这个包A还有依赖包B,C,D,那么只会卸载A,B,C,D。所以使用virtuallenv管理虚拟环境,卸载时会有残留.为解决这个问题,可以使用 pipenv
二 安装pipenv
1、pip install pipenv
这一个命令就安装好了,配置环境变量
pipenv 利用prefile 和 prefile.lock 记录包的依赖信息
2、使用pipenv 管理包
(1) pipenv install 有多种功能
1) pipenv install 后面没有包/模块名 在当前目录下创建虚拟环境.创建完成后,在当前目录下将生成两个文件prefile和prefile.lock
prefile 文件中,需要将url 修改为国内python源
dev-packages 记录安装在开发环境中的包 记录 pipenv install 包名 --dev
packages 记录安装包 记录 pipenv install 包名 安装的包
requires 记录python版本
pipenv和virtualenv 创建虚拟环境时有所不同.pipenv是将虚拟环境创建到当前路径,所以创建时,需要先cd到正确路径,然后创建;virtualenv 创建,无论在那个路径,创建后都是在.virtualenv目录下面
2) 在虚拟环境安装模块或者包 pipenv install 模块名/包名
3) 恢复虚拟环境 pipenv install 自动安装prefile文件中packages,不会安装dev-pakcages
4)恢复dev-packages pipenv install --dev
(2) 查看虚拟环境的依赖 先进入到虚拟环境的目录,然后输入 pipenv graph
(3)pipenv uninstall A 卸载虚拟环境中的包. 需要注意的是,A会被卸载,但是A的依赖不会被卸载。 卸载A时,会删除prefile和prefile.lock中的A,所以如果克隆该项目并恢复时,不会恢复A及A的依赖
边栏推荐
- Invalid operation: Load into table ‘sources_ orderdata‘ failed. Check ‘stl_ load_ errors‘ system table
- IPv6 experiment and summary
- The difference between session and cookies
- 实现strStr() II
- 递归(迷宫问题、8皇后问题)
- VLAN experiment of switching technology
- Hydration failed because the initial UI does not match what was rendered on the server.问题原因之一
- Eggjs -typeorm 之 TreeEntity 实战
- TensorRT中的循环
- Use of Arduino wire Library
猜你喜欢
随机推荐
Redis - grande question clé
eslint配置代码自动格式化
Redis——热点key问题
CUDA用户对象
Common means of modeling: combination
分布式事务 :可靠消息最终一致性方案
MySql索引
AtCoder Beginner Contest 253 F - Operations on a Matrix // 树状数组
Cglib agent - Code enhancement test
MySQL的10大经典错误
It is said that Kwai will pay for the Tiktok super fast version of the video? How can you miss this opportunity to collect wool?
Data science [9]: SVD (2)
Generic classes and parameterized classes of SystemVerilog
标签属性disabled selected checked等布尔类型赋值不生效?
Hydration failed because the initial UI does not match what was rendered on the server.问题原因之一
注解和反射详解以及运用
构建学习tensorflow
BGP routing optimization rules and notification principles
深入了解JUC并发(一)什么是JUC
AWD学习









