[{"data":1,"prerenderedAt":447},["ShallowReactive",2],{"content-query-zOauvh8I1C":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"category":13,"body":14,"_type":441,"_id":442,"_source":443,"_file":444,"_stem":445,"_extension":446},"/technology-blogs/zh/959","zh",false,"","小Mi的MindSpore安装经验之环境依赖常见问题及解决办法","准备好say Hello World了么？","2022-01-22","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/01/22/37a8e162451e41f7b0928d4c57db167d.png","technology-blogs","基础知识",{"type":15,"children":16,"toc":433},"root",[17,25,34,39,44,57,62,67,79,89,94,105,110,115,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,228,233,238,243,249,259,269,279,289,299,304,325,330,342,356,370,375,380,386,393,396,406,415,424],{"type":18,"tag":19,"props":20,"children":22},"element","h1",{"id":21},"小mi的mindspore安装经验之环境依赖常见问题及解决办法",[23],{"type":24,"value":8},"text",{"type":18,"tag":26,"props":27,"children":28},"p",{},[29],{"type":18,"tag":30,"props":31,"children":33},"img",{"alt":7,"src":32},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/01/22/3e7b5d1203e742e99be09e37b98a00f5.gif",[],{"type":18,"tag":26,"props":35,"children":36},{},[37],{"type":24,"value":38},"再长的路，一步步也能走完；再短的路，不迈出第一步也无法到达，想要体验MindSpore，一定是从安装开始。",{"type":18,"tag":26,"props":40,"children":41},{},[42],{"type":24,"value":43},"今天小Mi为大家整理安装过程中常出现的环境配置和依赖相关问题。",{"type":18,"tag":26,"props":45,"children":46},{},[47,49,55],{"type":24,"value":48},"1. 无论是什么方式和平台安装MindSpore，请",{"type":18,"tag":50,"props":51,"children":52},"strong",{},[53],{"type":24,"value":54},"务必确认所有规定的依赖及版本",{"type":24,"value":56},"。",{"type":18,"tag":26,"props":58,"children":59},{},[60],{"type":24,"value":61},"2. Ubuntu 18.0404自带环境与MindSpore要求不同，需要手动调整。",{"type":18,"tag":26,"props":63,"children":64},{},[65],{"type":24,"value":66},"3. gcc安装失败/如何安装/装不起来等问题，可参考以下两位的经验：",{"type":18,"tag":26,"props":68,"children":69},{},[70],{"type":18,"tag":71,"props":72,"children":76},"a",{"href":73,"rel":74},"https://bbs.huaweicloud.com/blogs/198349https://bbs.huaweicloud.com/blogs/198349",[75],"nofollow",[77],{"type":24,"value":78},"张小白教你如何在Ubuntu 18.04上源码安装MindSpore V1.0",{"type":18,"tag":26,"props":80,"children":81},{},[82],{"type":18,"tag":71,"props":83,"children":86},{"href":84,"rel":85},"https://bbs.huaweicloud.com/forum/forum.php?mod=viewthread&tid=143147&ordertype=2&page=1",[75],[87],{"type":24,"value":88},"mindspore1.3.0的编译环境之GCC7.3.0的安装",{"type":18,"tag":26,"props":90,"children":91},{},[92],{"type":24,"value":93},"4. 选择CUDA不同版本，对应的cuDNN版本也不同。CUDA 10.1对应cuDNN 7.6.x，而CUDA 11.1配套的cuDNN 8.0.x。",{"type":18,"tag":26,"props":95,"children":96},{},[97,99],{"type":24,"value":98},"5. CUDA安装请确认是否安装相应的cuDNN，一般需要自己手动安装。可以参考张小白博客内容：",{"type":18,"tag":71,"props":100,"children":103},{"href":101,"rel":102},"https://bbs.huaweicloud.com/blogs/309891",[75],[104],{"type":24,"value":101},{"type":18,"tag":26,"props":106,"children":107},{},[108],{"type":24,"value":109},"6. 使用pip安装时报错: ERROR: mindspore_{VERSION}.whl is not a supported wheel on this platform。",{"type":18,"tag":26,"props":111,"children":112},{},[113],{"type":24,"value":114},"A：pip会通过wheel安装包的文件名来判断该安装包是否与当前Python环境兼容，例如安装mindspore_ascend-1.2.0-cp37-cp37m-linux_aarch64.whl时，pip会检查:",{"type":18,"tag":116,"props":117,"children":118},"ul",{},[119,125,130],{"type":18,"tag":120,"props":121,"children":122},"li",{},[123],{"type":24,"value":124},"当前python环境为7.x版本",{"type":18,"tag":120,"props":126,"children":127},{},[128],{"type":24,"value":129},"当前操作系统为Linux",{"type":18,"tag":120,"props":131,"children":132},{},[133],{"type":24,"value":134},"操作系统架构为arm64",{"type":18,"tag":26,"props":136,"children":137},{},[138],{"type":24,"value":139},"因此，如果出现is not a supported wheel on this platform问题，请检查当前环境是否满足MindSpore安装要求，以及该MindSpore安装包版本是否正确。",{"type":18,"tag":26,"props":141,"children":142},{},[143],{"type":24,"value":144},"7. 使用pip安装依赖库时提示No matching distribution found for XXX错误，应该怎么办？",{"type":18,"tag":26,"props":146,"children":147},{},[148],{"type":24,"value":149},"A:请执行pip config list，查看当前软件库索引路径index-url。某些情况下，软件库索引会出现更新滞后，可尝试设置其它软件库索引路径。",{"type":18,"tag":26,"props":151,"children":152},{},[153],{"type":24,"value":154},"8. Ascend硬件平台，在个人的Conda环境中，有时候出现报错RuntimeError: json.exception.parse_error.101 parse error at line 1, column 1: syntax error while parsing value - invalid literal; last read: ‘T’，该怎么处理？",{"type":18,"tag":26,"props":156,"children":157},{},[158],{"type":24,"value":159},"A:出现这种类型的报错，大概率是run包更新后个人的Conda环境中没有更新te或topi或hccl工具包，可以将当前Conda环境中的上述几个工具包卸载，然后使用如下命令再重新安装: pip install /usr/local/Ascend/ascend-toolkit/latest/fwkacllib/lib64/{te/topi/hccl}-{version}-py3-none-any.whl。",{"type":18,"tag":26,"props":161,"children":162},{},[163],{"type":24,"value":164},"9. 在ARM架构的环境上使用pip安装MindSpore时报错: Could not find a version that satisfies the requirement应该怎么办？",{"type":18,"tag":26,"props":166,"children":167},{},[168],{"type":24,"value":169},"A:大概率是因为pip版本低于19.3，无法识别manylinux2014标签，导致pip install阶段下载了错误版本的numpy或scipy等python软件包，进而引发了无法找到构建依赖的问题，请执行pip install --upgrade pip将环境中的pip升级到19.3以上，重新安装MindSpore。",{"type":18,"tag":26,"props":171,"children":172},{},[173],{"type":24,"value":174},"10. 如何改变第三方依赖库安装路径？",{"type":18,"tag":26,"props":176,"children":177},{},[178],{"type":24,"value":179},"A:第三方依赖库的包默认安装在build/mindspore/.mslib目录下，可以设置环境变量MSLIBS_CACHE_PATH来改变安装目录，比如 export MSLIBS_CACHE_PATH = ~/.mslib。",{"type":18,"tag":26,"props":181,"children":182},{},[183],{"type":24,"value":184},"11. 环境上安装了Python3.7.5，环境变量设置正确，编译MindSpore时仍然报错Python3 not found，应该怎么办？",{"type":18,"tag":26,"props":186,"children":187},{},[188],{"type":24,"value":189},"A:可能是因为当前环境上的Python未包含动态库。编译MindSpore需要动态链接Python库，因此需要使用开启动态库编译选项的Python3.7.5，即在源码编译Python时使用./configure --enable-shared命令。",{"type":18,"tag":26,"props":191,"children":192},{},[193],{"type":24,"value":194},"12. 一些常用的环境变量设置，在新启动的终端窗口中需要重新设置，容易忘记应该怎么办？",{"type":18,"tag":26,"props":196,"children":197},{},[198],{"type":24,"value":199},"A:常用的环境变量设置写入到~/.bash_profile 或 ~/.bashrc中，可让环境变量设置在新启动的终端窗口中立即生效。",{"type":18,"tag":26,"props":201,"children":202},{},[203],{"type":24,"value":204},"13. 使用GPU版本MindSpore时，如何设置DEVICE_ID环境变量?",{"type":18,"tag":26,"props":206,"children":207},{},[208],{"type":24,"value":209},"A:MindSpore GPU模式一般无需设置DEVICE_ID环境变量，MindSpore会根据cuda环境变量CUDA_VISIBLE_DEVICES，自动选择可见的GPU设备。设置CUDA_VISIBLE_DEVICES环境变量后，则DEVICE_ID环境变量代表可见GPU设备的下标:执行export CUDA_VISIBLE_DEVICES=1,3,5后，DEVICE_ID应当被设置为0，1或2，若设置为3及以上，MindSpore会由于设备ID不合法而运行失败。",{"type":18,"tag":26,"props":211,"children":212},{},[213],{"type":24,"value":214},"14. 编译应用时报错/usr/bin/ld: warning: libxxx.so, needed by libmindspore.so, not found怎么办？",{"type":18,"tag":26,"props":216,"children":217},{},[218,220,227],{"type":24,"value":219},"A:寻找缺少的动态库文件所在目录，添加该路径到环境变量LD_LIBRARY_PATH中，环境变量设置参考",{"type":18,"tag":71,"props":221,"children":224},{"href":222,"rel":223},"https://www.mindspore.cn/docs/programming_guide/zh-CN/r1.5/multi_platform_inference_ascend_310_mindir.html#id6",[75],[225],{"type":24,"value":226},"Ascend 310 AI处理器上使用MindIR模型进行推理#编译推理代码",{"type":24,"value":56},{"type":18,"tag":26,"props":229,"children":230},{},[231],{"type":24,"value":232},"15. 运行应用时出现ModuleNotFoundError: No module named 'te'怎么办？",{"type":18,"tag":26,"props":234,"children":235},{},[236],{"type":24,"value":237},"首先确认环境安装是否正确，te、topi等whl包是否正确安装。如果用户环境中有多个Python版本，如Conda虚拟环境中，需ldd name_of_your_executable_app确认应用所链接的libpython3.so是否与当前Python路径一致，如果不一致需要调整环境变量LD_LIBRARY_PATH顺序，例：export LD_LIBRARY_PATH=`python -c \"import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))\"`:$LD_LIBRARY_PATH",{"type":18,"tag":26,"props":239,"children":240},{},[241],{"type":24,"value":242},"将当前的python命令对应程序的运行库路径加入到LD_LIBRARY_PATH的最前面。",{"type":18,"tag":244,"props":245,"children":247},"h3",{"id":246},"优秀用户经验分享",[248],{"type":24,"value":246},{"type":18,"tag":26,"props":250,"children":251},{},[252],{"type":18,"tag":71,"props":253,"children":256},{"href":254,"rel":255},"https://bbs.huaweicloud.com/forum/thread-175090-1-1.html",[75],[257],{"type":24,"value":258},"[深夜上线]MindSpore的CPU在win10x64下安装（超详细，小白可懂）",{"type":18,"tag":26,"props":260,"children":261},{},[262],{"type":18,"tag":71,"props":263,"children":266},{"href":264,"rel":265},"https://bbs.huaweicloud.com/forum/thread-166372-1-1.html",[75],[267],{"type":24,"value":268},"保姆式教程教你如何一步步在window10系统下安装mindspore框架+pycharm导入python遇到的问题解决",{"type":18,"tag":26,"props":270,"children":271},{},[272],{"type":18,"tag":71,"props":273,"children":276},{"href":274,"rel":275},"https://bbs.huaweicloud.com/forum/thread-169577-1-1.html",[75],[277],{"type":24,"value":278},"MindSpore GPU版本安装指导",{"type":18,"tag":26,"props":280,"children":281},{},[282],{"type":18,"tag":71,"props":283,"children":286},{"href":284,"rel":285},"https://bbs.huaweicloud.com/forum/thread-139738-1-1.html",[75],[287],{"type":24,"value":288},"pip方式安装MindSpore Ascend 910版本",{"type":18,"tag":26,"props":290,"children":291},{},[292],{"type":18,"tag":71,"props":293,"children":296},{"href":294,"rel":295},"https://bbs.huaweicloud.com/forum/forum.php?mod=viewthread&tid=97495",[75],[297],{"type":24,"value":298},"Windows上体验源码编译安装MindSpore",{"type":18,"tag":244,"props":300,"children":302},{"id":301},"解决路径",[303],{"type":24,"value":301},{"type":18,"tag":26,"props":305,"children":306},{},[307,309,316,318],{"type":24,"value":308},"非注意事项提到的问题可以通过查询论坛 ",{"type":18,"tag":71,"props":310,"children":313},{"href":311,"rel":312},"https://bbs.huaweicloud.com/forum/forum.php?mod=forumdisplay&orderby=lastpost&fid=1076&filter=typeid&typeid=2105.html",[75],[314],{"type":24,"value":315},"问题求助-安装",{"type":24,"value":317},"或官网 ",{"type":18,"tag":71,"props":319,"children":322},{"href":320,"rel":321},"https://www.mindspore.cn/docs/faq/zh-CN/r1.5/installation.html",[75],[323],{"type":24,"value":324},"FAQ-安装",{"type":18,"tag":26,"props":326,"children":327},{},[328],{"type":24,"value":329},"来查询同类问题的解决方式。",{"type":18,"tag":26,"props":331,"children":332},{},[333,335],{"type":24,"value":334},"如果您遇到了问题并成功解决，也可以分享相关经验到论坛 ",{"type":18,"tag":71,"props":336,"children":339},{"href":337,"rel":338},"https://bbs.huaweicloud.com/forum/forum.php?mod=forumdisplay&orderby=lastpost&fid=1076&filter=typeid&typeid=2475",[75],[340],{"type":24,"value":341},"技术干货-安装经验",{"type":18,"tag":26,"props":343,"children":344},{},[345,347,354],{"type":24,"value":346},"《",{"type":18,"tag":71,"props":348,"children":351},{"href":349,"rel":350},"https://www.mindspore.cn/resources/courses/introduce?id=61&courseId=4&;=%E5%88%9D%E7%BA%A7%E8%AF%BE%E7%A8%8B%20%3E%20%E6%89%8B%E6%8A%8A%E6%89%8B%E5%AE%89%E8%A3%85%E4%B8%8E%E4%BD%93%E9%AA%8CMindSpore%20%3E%20%E7%B3%BB%E5%88%97%E4%B8%80%EF%BC%9A%E5%AE%89%E8%A3%85MindSpore",[75],[352],{"type":24,"value":353},"手把手安装教程",{"type":24,"value":355},"》系列视频看这里。",{"type":18,"tag":26,"props":357,"children":358},{},[359,361,368],{"type":24,"value":360},"如果上述方式都没有解决您的问题，欢迎到论坛",{"type":18,"tag":71,"props":362,"children":365},{"href":363,"rel":364},"https://bbs.huaweicloud.com/forum/forum.php?mod=forumdisplay&orderby=lastpost&fid=1076&filter=typeid&typeid=1254sub",[75],[366],{"type":24,"value":367},"问题求助板块",{"type":24,"value":369},"发帖求助，我们的技术支撑将在第一时间给您回复。",{"type":18,"tag":26,"props":371,"children":372},{},[373],{"type":24,"value":374},"欢迎补充本篇遗漏内容~",{"type":18,"tag":26,"props":376,"children":377},{},[378],{"type":24,"value":379},"看到这里，准备好say Hello World了么？",{"type":18,"tag":244,"props":381,"children":383},{"id":382},"扫描下方二维码加入mindspore项目",[384],{"type":24,"value":385},"扫描下方二维码加入MindSpore项目",{"type":18,"tag":26,"props":387,"children":388},{},[389],{"type":18,"tag":30,"props":390,"children":392},{"alt":7,"src":391},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/01/09/984c702452434b10817b9084c6a2cee6.jpg",[],{"type":18,"tag":244,"props":394,"children":395},{"id":7},[],{"type":18,"tag":26,"props":397,"children":398},{},[399],{"type":18,"tag":71,"props":400,"children":403},{"href":401,"rel":402},"http://mp.weixin.qq.com/s?__biz=MzAxMDA1MDM0NQ==&mid=2247541446&idx=1&sn=f397c4aadf6313efe8c16d15cec8db3d&chksm=9b542c80ac23a596935839754dc4690c6c0a20319c1bb23c67bc3bd7b527c8cf6d3c1efcc9a9&scene=21#wechat_redirect",[75],[404],{"type":24,"value":405},"MindSpore官方资料",{"type":18,"tag":26,"props":407,"children":408},{},[409],{"type":18,"tag":71,"props":410,"children":412},{"href":401,"rel":411},[75],[413],{"type":24,"value":414},"GitHub : https://github.com/mindspore-ai/mindspore",{"type":18,"tag":26,"props":416,"children":417},{},[418],{"type":18,"tag":71,"props":419,"children":421},{"href":401,"rel":420},[75],[422],{"type":24,"value":423},"Gitee : https : //gitee.com/mindspore/mindspore",{"type":18,"tag":26,"props":425,"children":426},{},[427],{"type":18,"tag":71,"props":428,"children":430},{"href":401,"rel":429},[75],[431],{"type":24,"value":432},"官方QQ群 : 486831414",{"title":7,"searchDepth":434,"depth":434,"links":435},4,[436,438,439,440],{"id":246,"depth":437,"text":246},3,{"id":301,"depth":437,"text":301},{"id":382,"depth":437,"text":385},{"id":7,"depth":437,"text":7},"markdown","content:technology-blogs:zh:959.md","content","technology-blogs/zh/959.md","technology-blogs/zh/959","md",1776506142514]