pythonpipenv的使用
python中pipenv的使用
1、使用前提
前提:假设我们在用户目录~下有一个项目叫my_project/
我们首先进入项目目录:
cd~/my_project
进入项目后,如果直接执行pipenvvinstall,pipen会根据系统默认的python版本创建一个虚拟环境。(前提是这个项目中不存在现有的Pipfile,如果存在,它会根据Pipfile安装Pipfile中记录的相应版本和依赖库)。
但是我们在创建虚拟环境时通常会指定python版本,这需要匹配两三个参数:
-two使用python2创建虚拟环境。
-three使用python3创建虚拟环境。
pipenvinstall--three#需要确保系统中存在python3版本
2、实例
下面是执行后的输出信息:
Creatingavirtualenvforthisproject…
Using/usr/local/bin/python3tocreatevirtualenv…
#这里可以看到继承自哪个python版本
⠋Runningvirtualenvwithinterpreter/usr/local/bin/python3Usingbaseprefix'/usr/local'
Newpythonexecutablein/root/.local/share/virtualenvs/my_project-dhpIKgdN/bin/python3
Alsocreatingexecutablein/root/.local/share/virtualenvs/my_project-dhpIKgdN/bin/python
Installingsetuptools,pip,wheel...done.
#这里可以看到虚拟环境安装的位置
Virtualenvlocation:/root/.local/share/virtualenvs/my_project-dhpIKgdN
CreatingaPipfileforthisproject…
Pipfile.locknotfound,creating…
Locking[dev-packages]dependencies…
Locking[packages]dependencies…
UpdatedPipfile.lock(625834)!
InstallingdependenciesfromPipfile.lock(625834)…
�▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉0/0—00:00:00
Toactivatethisproject'svirtualenv,runthefollowing:
$pipenvshell#要激活该虚拟环境,执行这条指令
以上就是python中pipenv的使用,希望能对大家有所帮助,更多Python学习教程请关注IT培训机构:千锋教育。

猜你喜欢LIKE
相关推荐HOT
更多>>
python调用dll
在python中调用dll文件中的接口比较简单,实例代码如下:如我们有一个test.dll文件,内部定义如下:extern"C"{int__stdcalltest(void*p,intlen)...详情>>
2023-11-08 23:31:04
pythonpathlib模块的用法有哪些?
python中pathlib模块的用法有哪些?在这个世界上,人们每天都在用Python完成着不同的工作。而文件操作,则是大家最常需要解决的任务之一。使用Py...详情>>
2023-11-08 18:37:21
pythonPyramid框架是什么?
python中Pyramid框架是什么?本文教程操作环境:windows7系统、Python3.9.1,DELLG3电脑。1、说明Pyramid以其高效率和快节奏的开发能力而出名。P...详情>>
2023-11-08 08:56:32
pythongil是什么
pythongil是什么1、说明是全局解释器锁,每个线程在执行时候都需要先获取GIL,保证同一时刻只有一个线程可以执行代码,即同一时刻只有一个线程...详情>>
2023-11-08 05:44:47热门推荐
技术干货






