Spyder - UMD已删除:模块 [英] Spyder - UMD has deleted: module

查看:472
本文介绍了Spyder - UMD已删除:模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在一直在用python玩弄大约一个月,有些事情正在困扰着我。
我使用python(x,y)工具包,它配有整洁的Spyder IDE。
我的问题涉及Spyder的UMD(用户模块删除器)。



我发现这个在互联网上的图形模块,这有助于在python脚本中做一些简单的图形工作(据我所知)。



它不像我卡住了,但是当我执行下面的代码时:

  import pylab as p 
import graphics as g

window = g.GraphWin(tryout,600,600)
window.close()
print p。 sqrt(4)

输出结果如下:

 >>> runfile(r'C:\some\folders\tryout.py',wdir = r'C:\some\folders') 
>>> UMD已删除:graphics
>>> 2.0

第1行显然是好的第3行也是如此,但我没有看到第2行。
此外,激励窗口闪烁进出屏幕,正如它应该的那样。
第2行似乎没有任何伤害,我可以完美重新运行该文件多次,但我想知道它来自哪里。



AFAIK UMD每次运行脚本时都会强制解释器重新加载模块。
显示的消息是否意味着'它'已经删除了对模块的引用,因为它不再被使用,还是其他东西?或者这是否意味着什么是错误的,并且它会'伤害'我的代码,我应该添加更多之后?

注意:第一个问题,所以请评论它的废话帮助我提高技巧。

编辑:我试着在测试线上移动 print p.sqrt 4),并发现它并不重要。如果它在导入模块之后的第一行,它仍然在显示sqrt(4)之前提出消息 答:

也许已删除不是您提到的邮件中最好的单词。它应该被重新加载,这是UMD真正做的,因为它不那么令人困惑。我会在问题追踪器中填写相关问题。



长答案:

UMD不仅会重新载入你的脚本,还会重载它所依赖的所有本地模块。通过 local 我的意思是你的Python安装之外的模块,并且你有写权限。



这个想法是,在你的脚本旁边,也许你已经开发了一个辅助函数库以配合它。所以你很可能也想重新加载这个库,所以对它的任何修改都会在运行时反映出来。



我知道这不是你的情况,所以如果你想要删除该消息,您可以转到:

工具> 首选项 >> 高级设置> 用户模块删除器



并停用选项

显示重新加载的模块列表


I have been fooling around for about a month with python now and something is bothering me. I use the python(x,y) toolkit, which comes with the neat Spyder IDE. My question concerns the UMD (User module deleter) of Spyder.

I found this graphics module on the internet, which helps one to do some simple graphic stuff in a python script (as far as I understand).

It is not like i'm stuck, but when I execute the folowing code:

import pylab as p
import graphics as g

window = g.GraphWin("tryout", 600, 600)
window.close()
print p.sqrt(4)

The output is:

>>>runfile(r'C:\some\folders\tryout.py', wdir=r'C:\some\folders')
>>>UMD has deleted: graphics
>>>2.0

line 1 is obviously o.k. and so is line 3, but I don't get line 2. Also, the provoked window flashes in and out of the screen, as it should. Line 2 doesn't seem to do any harm, and i can perfectly rerun the file as many times as I wan't, but I want to know where it is comming from.

AFAIK UMD forces the interpreter to reload a module everytime a script is run. Does the displayed message mean that 'it' has deleted the references to the module, because it isn't used anymore, or is it something else? Or does it mean something is wrong, and will it 'hurt' my code should I add more afterwards?

Note: first question, so please comment the crap out of it to help me improve my asking skills.

EDIT: i tried shifting around the test line print p.sqrt(4), and found out that it doesn't matter where I put it. If its the first line after importing the modules, it still raisses the message before showing sqrt(4)

解决方案

Short Answer:

Perhaps deleted is not the best word in the message you mention. It should be reloaded, which is what UMD is really doing and because is way less confusing. I'll fill an issue for this in our issue tracker.

Long answer:

UMD reloads not only your script but also all the local modules it depends on. By local I mean modules outside your Python installation and over which you have writing permissions.

The idea is that next to your script, perhaps you have developed a library of auxiliary functions to go with it. So you most probably want to reload that library too, so that any changes to it are reflected at run time.

I know this is not your case, so if you want to remove that message, you can go to:

Tools > Preferences > Console > Advanced settings > User Module Deleter

and deactivate the option

Show reloaded modules list

这篇关于Spyder - UMD已删除:模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆