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

您所在的位置:网站首页 python运行不了文件 关于python可以运行,但不能debug的问题

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

2023-08-13 08:30| 来源: 网络整理| 查看: 265

问题描述:搭建深度学习框架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       import numpy as np 

在网上搜了好几种办法:

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

更换python版本:结果不行

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

正确的变量应为:

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

更改后debug恢复。

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



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3