windows下vscode环境c++利用matplotlibcpp绘图的问题

 一、vscode下c++使用matplotlib-cpp的环境配置

        我配置环境主要借鉴于这位博主的文章

vscode下c++使用matplotlib-cpp的环境配置教程_matplotlibcpp.h:353:37: error: expected ',' before-CSDN博客


二、报错信息

2.1 Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding,按照网上的教程修改系统环境变量,PYTHONHOME和PYTHONPATH的为anaconda的目录,但是gbd调试,会直接修改PYTHONHOME的值,变成mingw/opt

解决方法:除了在系统环境变量中添加PYTHONHOME和PYTHONPATH以外,在launch.json中添加"environment": [{"name": "PYTHONHOME", "value": "D:\\software\\python3.9.12"}],

2.2 ModuleNotFoundError: No module named 'numpy' ModuleNotFoundError: No module named 'matplotlib' terminate called after throwing an instance of 'std::runtime_error' what(): Error loading module matplotlib!

解决方法:在python中用pip安装numpy和matplotlib即可

命令行中运行pip3 install --user numpy matplotlib


  • 10
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值