位置: IT常识 - 正文

python如何建立venv虚拟环境(python如何建立函数)

编辑:rootadmin
创建虚拟环境

推荐整理分享python如何建立venv虚拟环境(python如何建立函数),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:python如何建立列表,python如何建立函数,Python如何建立多元线性回归方程,Python如何建立集合,Python如何建立字典,Python如何建立字典,Python如何建立字典,python如何建立列表,内容如对您有帮助,希望把文章链接给更多的朋友!

在当前目录创建虚拟环境:

$python-mvenv.1

下面是”venv”的详细使用参数:

usage:venv[-h][--system-site-packages][--symlinks][--clear][--upgrade][--without-pip]ENV_DIR[ENV_DIR...]CreatesvirtualPythonenvironmentsinoneormoretargetdirectories.positionalarguments:ENV_DIRAdirectorytocreatetheenvironmentin.optionalarguments:-h,--helpshowthishelpmessageandexit--system-site-packagesGiveaccesstotheglobalsite-packagesdirtothevirtualenvironment.--symlinksTrytousesymlinksratherthancopies,whensymlinksarenotthedefaultfortheplatform.--copiesTrytousecopiesratherthansymlinks,evenwhensymlinksarethedefaultfortheplatform.--clearDeletetheenvironmentdirectoryifitalreadyexists.Ifnotspecifiedandthedirectoryexists,anerrorisraised.--upgradeUpgradetheenvironmentdirectorytousethisversionofPython,assumingPythonhasbeenupgradedin-place.--without-pipSkipsinstallingorupgradingpipinthevirtualenvironment(pipisbootstrappedbydefault)激活虚拟环境

在Posix标准平台下:

$source<venv>/bin/activatepython如何建立venv虚拟环境(python如何建立函数)

在Windows cmd下:

C:><venv>/Scripts/activate.bat

在Windows PowerShell下:

PSC:><venv>/Scripts/Activate.ps1测试虚拟环境

激活虚拟环境后,在命令行会提示当前虚拟环境的名称,就表示激活成功了。

在当前虚拟环境中安装numpy:

$pipinstallnumpy

当前安装的numpy包与系统中的不会冲突,下面进行测试:

$python>>>importnumpy>>>print(numpy)

如果输出了numpy的包路径就表示一切正常。

官方文档参考

更多Python文章,请关注Python自学网。

本文链接地址:https://www.jiuchutong.com/zhishi/312969.html 转载请保留说明!

上一篇:OK源码中国推荐2022年微擎模块服务评价v2.2.8-OK源码中国破解(kppw源码)

下一篇:OK源码中国提醒大家,禁止关闭主题的api功能,严重影响网站运行各种功能(免费开源okr管理系统)

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络