VSCode和PyOpenGL导入错误?

时间:2018-09-09 07:22:10

标签: python opengl visual-studio-code python-import

以正常IDLE运行此代码完全可以。

import OpenGL.GL as gl

但是在VSCode中,出现导入错误。

No module named 'OpenGL.GL'; 'OpenGL' is not a package
File "C:\Users\Fluffy\Desktop\OpenGL.py", line 1, in <module>
import OpenGL.GL as gl
File "C:\users\fluffy\desktop\&lt;frozen importlib._bootstrap&gt;", line 219, in _call_with_frames_removed
File "C:\users\fluffy\desktop\&lt;frozen importlib._bootstrap_external&gt;", line 678, in exec_module
File "C:\users\fluffy\desktop\&lt;frozen importlib._bootstrap&gt;", line 665, in _load_unlocked
File "C:\users\fluffy\desktop\&lt;frozen importlib._bootstrap&gt;", line 955, in _find_and_load_unlocked
File "C:\users\fluffy\desktop\&lt;frozen importlib._bootstrap&gt;", line 971, in _find_and_load
File "C:\users\fluffy\desktop\&lt;frozen importlib._bootstrap&gt;", line 219, in _call_with_frames_removed
File "C:\users\fluffy\desktop\&lt;frozen importlib._bootstrap&gt;", line 941, in _find_and_load_unlocked
File "C:\users\fluffy\desktop\&lt;frozen importlib._bootstrap&gt;", line 971, in _find_and_load
File "C:\Users\fluffy\Desktop\OpenGL.py", line 1, in <module>
import OpenGL.GL as gl

此外,我卸载了PyOpenGL,并注意到VSCode的intellisense在python中找到了一个现有的OpenGL模块: link

我很确定它与VSCode从python导入模块的方式有关。

注意:我尝试以多种不同方式重新安装PyOpenGL,但错误仍然存​​在。

0 个答案:

没有答案