|
文章目录一、yaml包的介绍二、使用报错及安装成功一、yaml包的介绍yaml是一种文件格式,跟json一样通常被用作配置文件,但远比JSON格式方便!使用json作为配置文件的朋友会发现,在json中写注释要通过增加键值对的形式来,但是yaml格式就非常的友好!建议使用yaml来写配置文件,如下为yaml格式的示例:二、使用报错及安装成功我训练模型的时候,出现了错误,如下所示:Traceback(mostrecentcalllast):File"train.py",line24,inimportyamlModuleNotFoundError:Nomodulenamed'yaml'1234ModuleNotFoundError:Nomodulenamed'yaml'1说明我们的环境中缺乏yaml包,尝试安装:pipinstallyaml1但是报错:Lookinginindexes:http://mirrors.aliyun.com/pypi/simpleERROR:Couldnotfindaversionthatsatisfiestherequirementyaml(fromversions:none)ERROR:Nomatchingdistributionfoundforyaml123其实正确的命令行内容应该是如下所示:pipinstallpyyaml1这样就成功了!如下所示:Lookinginindexes:https://pypi.tuna.tsinghua.edu.cn/simpleCollectingpyyamlDownloadinghttps://pypi.tuna.tsinghua.edu.cn/packages/c8/6b/6600ac24725c7388255b2f5add93f91e58a5d7efaf4af244fdbcc11a541b/PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl(736kB)|████████████████████████████████|736kB1.1MB/sInstallingcollectedpackages:pyyamlSuccessfullyinstalledpyyaml-6.0.1WARNING:Runningpipasthe'root'usercanresultinbrokenpermissionsandconflictingbehaviourwiththesystempackagemanager.Itisrecommendedtouseavirtualenvironmentinstead:https://pip.pypa.io/warnings/venv1234567
|
|