简体   繁体   English

在Wing IDE中加载模块

[英]Load Modules in Wing IDE

I am new to Python and am having trouble loading numpy in Wing IDE. 我是Python新手,无法在Wing IDE中加载numpy。 I can load the module and use it fine in the command line but not in Wing IDE. 我可以加载模块并在命令行中正常使用它,但不能在Wing IDE中使用它。 Below is what I am seeing: 以下是我所看到的:

code: 码:

import numpy as np 将numpy导入为np

a=np.arange(15) 一个= np.arange(15)

result: 结果:

[evaluate numpy.py] Traceback (most recent call last): File "C:\\Users[my name]\\Documents\\Python\\practice\\numpy.py", line 2, in 0 builtins.NameError: name 'arange' is not defined [evaluate numpy.py]追溯(最近一次通话):文件“ C:\\ Users [我的名字] \\ Documents \\ Python \\ practice \\ numpy.py”,第2行,内置0个instanceName.NameError:名称“ arange”为没有定义的

I have also tried to use the help() command: 我也尝试过使用help()命令:

code: 码:

help(np) 帮助(NP)

result: 结果:

Help on module numpy: 关于numpy模块的帮助:

NAME numpy NAME numpy

FILE c:\\users[my name]\\documents\\python\\practice\\numpy.py FILE c:\\ users [我的名字] \\ documents \\ python \\ practice \\ numpy.py

It is probably due to your code being in a file named numpy.py If you do this then 'import numpy' may import your module and not numpy. 这可能是由于您的代码位于名为numpy.py的文件中。如果执行此操作,则“ import numpy”可能会导入您的模块,而不是numpy。 This depends on what's on the Python Path and possibly current directory, which probably explains why it works outside of Wing. 这取决于Python路径以及当前目录中的内容,这可能解释了为什么它在Wing之外可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM