关于python可以运行,但不能debug的问题

问题描述:搭建深度学习框架tensorflow (cup版),python 3.8.8。搭建完成后可以正常运行代码,但不能正常debug。打开debug后回报错误。

代码第一行为

import numpy as np

所以debug后,就开始报错:找不到numpy模块,并给出了当前的python和numpy的版本号,让检查是否正确(忘记截图)。再降低numy版本从1.22.0到1.18.1后,重启vscode并debug。报错发生了变化,但通体上说的还是找模块:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! 

Importing the numpy c-extensions failed. 
- Try uninstalling and reinstalling numpy. 
- If you have already done that, then: 
  1. Check that you expected to use Python3.8 from "D:\anacconda\envs\tensorflow38\python.exe", 
     and that you have no directories in your PATH or PYTHONPATH that can 
     interfere with the Python and numpy version "1.18.1" you're trying to use. 
  2. If (1) looks fine, you can open a new issue at 
     https://github.com/numpy/numpy/issues.   Please include details on: 
     - how you installed Python 
     - how you installed numpy 
     - your operating system 
     - whether or not you have multiple versions of Python installed 
     - if you built from source, your compiler versions and ideally a build log 

- If you're working with a numpy git repository, try `git clean -xdf` 
  (removes all files not under version control) and rebuild numpy. 

Note: this error has many possible causes, so please don't comment on 
an existing issue about this - open a new one instead. 

Original error was: DLL load failed while importing _multiarray_umath: 找不到指定的模块。 

During handling of the above exception, another exception occurred: 

  File "D:\Qi\deep_learning_work\homework1\download_dataset.py", line 10, in <module> 
    import numpy as np 

在网上搜了好几种办法:

如conda安装不行,删除用pip装:结果不行

更换python版本:结果不行

最后解决办法为检查环境变量,发现环境变量加入有问题:

正确的变量应为:

D:\anacconda\envs\tensorflow38\Library\bin 

更改后debug恢复。

ps:为这个bug弄了一下午,整个一个大无语

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

By-Q

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值