搜索
首页后端开发Python教程conda如何配置python虚拟环境

    一、创建python虚拟环境

    首先选中要配置环境的文件
    如下:

    conda如何配置python虚拟环境

    在此处输入cmd按回车
    此处我创建一个环境名为hands3dtext,环境版本为3.7.2的初始环境

    conda create -n hands3dtext python==3.7.2

    conda如何配置python虚拟环境

    创建成功如下:

    conda如何配置python虚拟环境

    二、配置刚创建的虚拟环境

    首先激活刚创建的虚拟环境

    conda activate hands3dtext

    conda如何配置python虚拟环境

    如上前面小括号显示表示激活成功,此时正处于虚拟环境
    接下来就可以安装所需的一切包和库
    注意安装前要确认安装cpu还是gpu的版本
    此处我需要安装mediapipe
    注意:安装mediapipe首先安装opencv,终端执行

    conda install opencv-contrib-python

    上一条可能出错可以采用下面这样采用国内清华镜像源

    pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple

    然后安装mediapipe,终端执行

    conda install mediapipe

    我还需要安装tqdm模块(根据个人需要)

    conda install tqdm

    如果觉得安装太慢可以切换国内镜像源进行安装,执行如下命令即可

    conda config --remove-key channels
    conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
    conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
    conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/pytorch/
    conda config --set show_channel_urls yes
    pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple

    pytorch安装(gpu版本和cpu版本的安装)

    GPU版本安装的具体步骤可以参考这篇文章:2021年Windows下安装GPU版本的Tensorflow和Pytorch_dejahu的博客-CSDN博客

    需要注意以下几点:

    1、安装之前一定要先更新你的显卡驱动,去官网下载对应型号的驱动安装
    2、30系显卡只能使用cuda11的版本
    3、一定要创建虚拟环境,这样的话各个深度学习框架之间不发生冲突

    conda install pytorch==1.8.0 torchvision torchaudio cudatoolkit=10.2 
    # 注意这条命令指定Pytorch的版本和cuda的版本
    conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cpuonly 
    # CPU的小伙伴直接执行这条命令即可

    pycocotools的安装

    pip install pycocotools-windows

    其他包的安装

    pip install -r requirements.txt
    pip install pyqt5
    pip install labelme

    三、将虚拟环境配置到相应项目

    首先打开相应项目,按照图标指引找到刚创建的虚拟环境

    conda如何配置python虚拟环境

    点击ok,等待配置完成即可

    以上是conda如何配置python虚拟环境的详细内容。更多信息请关注PHP中文网其他相关文章!

    声明
    本文转载于:亿速云。如有侵权,请联系admin@php.cn删除
    Python:编译器还是解释器?Python:编译器还是解释器?May 13, 2025 am 12:10 AM

    Python是解释型语言,但也包含编译过程。1)Python代码先编译成字节码。2)字节码由Python虚拟机解释执行。3)这种混合机制使Python既灵活又高效,但执行速度不如完全编译型语言。

    python用于循环与循环时:何时使用哪个?python用于循环与循环时:何时使用哪个?May 13, 2025 am 12:07 AM

    useeAforloopWheniteratingOveraseQuenceOrforAspecificnumberoftimes; useAwhiLeLoopWhenconTinuingUntilAcIntiment.ForloopSareIdeAlforkNownsences,而WhileLeleLeleLeleLoopSituationSituationSituationsItuationSuationSituationswithUndEtermentersitations。

    Python循环:最常见的错误Python循环:最常见的错误May 13, 2025 am 12:07 AM

    pythonloopscanleadtoerrorslikeinfiniteloops,modifyingListsDuringteritation,逐个偏置,零indexingissues,andnestedloopineflinefficiencies

    对于循环和python中的循环时:每个循环的优点是什么?对于循环和python中的循环时:每个循环的优点是什么?May 13, 2025 am 12:01 AM

    forloopsareadvantageousforknowniterations and sequests,供应模拟性和可读性;而LileLoopSareIdealFordyNamicConcitionSandunknowniterations,提供ControloperRoverTermination.1)forloopsareperfectForeTectForeTerToratingOrtratingRiteratingOrtratingRitterlistlistslists,callings conspass,calplace,cal,ofstrings ofstrings,orstrings,orstrings,orstrings ofcces

    Python:深入研究汇编和解释Python:深入研究汇编和解释May 12, 2025 am 12:14 AM

    pythonisehybridmodelofcompilationand interpretation:1)thepythoninterspretercompilesourcececodeintoplatform- interpententbybytecode.2)thepytythonvirtualmachine(pvm)thenexecuteCutestestestesteSteSteSteSteSteSthisByTecode,BelancingEaseofuseWithPerformance。

    Python是一种解释或编译语言,为什么重要?Python是一种解释或编译语言,为什么重要?May 12, 2025 am 12:09 AM

    pythonisbothinterpretedAndCompiled.1)它的compiledTobyTecodeForportabilityAcrosplatforms.2)bytecodeisthenInterpreted,允许fordingfordforderynamictynamictymictymictymictyandrapiddefupment,尽管Ititmaybeslowerthananeflowerthanancompiledcompiledlanguages。

    对于python中的循环时循环与循环:解释了关键差异对于python中的循环时循环与循环:解释了关键差异May 12, 2025 am 12:08 AM

    在您的知识之际,而foroopsareideal insinAdvance中,而WhileLoopSareBetterForsituations则youneedtoloopuntilaconditionismet

    循环时:实用指南循环时:实用指南May 12, 2025 am 12:07 AM

    ForboopSareSusedwhenthentheneMberofiterationsiskNownInAdvance,而WhileLoopSareSareDestrationsDepportonAcondition.1)ForloopSareIdealForiteratingOverSequencesLikelistSorarrays.2)whileLeleLooleSuitableApeableableableableableableforscenarioscenarioswhereTheLeTheLeTheLeTeLoopContinusunuesuntilaspecificiccificcificCondond

    See all articles

    热AI工具

    Undresser.AI Undress

    Undresser.AI Undress

    人工智能驱动的应用程序,用于创建逼真的裸体照片

    AI Clothes Remover

    AI Clothes Remover

    用于从照片中去除衣服的在线人工智能工具。

    Undress AI Tool

    Undress AI Tool

    免费脱衣服图片

    Clothoff.io

    Clothoff.io

    AI脱衣机

    Video Face Swap

    Video Face Swap

    使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

    热门文章

    热工具

    EditPlus 中文破解版

    EditPlus 中文破解版

    体积小,语法高亮,不支持代码提示功能

    PhpStorm Mac 版本

    PhpStorm Mac 版本

    最新(2018.2.1 )专业的PHP集成开发工具

    SublimeText3 Linux新版

    SublimeText3 Linux新版

    SublimeText3 Linux最新版

    WebStorm Mac版

    WebStorm Mac版

    好用的JavaScript开发工具

    ZendStudio 13.5.1 Mac

    ZendStudio 13.5.1 Mac

    功能强大的PHP集成开发环境