来自WinPython的iPython为PyGObject / PyGi引发了ImportError

时间:2014-06-12 16:30:27

标签: python ipython importerror pygobject

我必须再次编写科学软件。但这次它必须在带有Windows的测量计算机上运行。为此,我安装了WinPython 3.3.5 (32 bit)PyGObject 3.12.2 with GTK+3.8.9 (32 bit)

WinPython Interpreter工作:

Python 3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:37:12) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; print(sys.path)
['',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\python33.zip',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\DLLs',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\FontTools',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\win32',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\win32\\lib',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\Pythonwin']
>>> import gi
>>>

WinPython命令提示符也适用:

C:\WinPython-32bit-3.3.5.0\python-3.3.5>echo %path%
C:\WinPython-32bit-3.3.5.0\python-3.3.5\Lib\site-packages\PyQt4;
C:\WinPython-32bit-3.3.5.0\python-3.3.5\;
C:\WinPython-32bit-3.3.5.0\python-3.3.5\DLLs;
C:\WinPython-32bit-3.3.5.0\python-3.3.5\Scripts;
C:\WinPython-32bit-3.3.5.0\python-3.3.5\..\tools;
C:\WinPython-32bit-3.3.5.0\python-3.3.5\..\tools\gnuwin32\bin;
C:\MinGW\bin;
C:\Windows\system32;
C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\WinPython-32bit-3.3.5.0\python-3.3.5\..\tools\TortoiseHg

C:\WinPython-32bit-3.3.5.0\python-3.3.5>python
Python 3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:37:12) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>>

虽然WinPython是可移植的,但普通的Windows'cmd.exe也可以工作:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.

C:\WinPython-32bit-3.3.5.0\python-3.3.5>echo %path%
C:\MinGW\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\
System32\WindowsPowerShell\v1.0\

C:\WinPython-32bit-3.3.5.0\python-3.3.5>python
Python 3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:37:12) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; print(sys.path)
['',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\python33.zip',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\DLLs',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\FontTools',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\win32',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\win32\\lib',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\Pythonwin']
>>> import gi
>>>

但IPython Qt控制台没有:

Python 3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:37:12) [MSC v.1600 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 2.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
%guiref   -> A brief reference about the graphical user interface.

In [1]: import sys; print(sys.path)
['',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\python33.zip',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\DLLs',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\FontTools',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\win32',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\win32\\lib',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\Pythonwin',
'C:\\WinPython-32bit-3.3.5.0\\python-3.3.5\\lib\\site-packages\\IPython\\extensions',
'C:\\WinPython-32bit-3.3.5.0\\settings\\.ipython']

In [2]: import gi
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-a23efdcdbcd8> in <module>()
----> 1 import gi

C:\WinPython-32bit-3.3.5.0\python-3.3.5\lib\site-packages\gi\__init__.py in <module>()
     34                       'of "import gobject" to "from gi.repository import GObject".')
     35 
---> 36 from ._gi import _gobject
     37 from ._gi import _API
     38 from ._gi import Repository

ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.


In [3]:

一方面,iPython非常有用,另一方面,py2exe也没有在每个具有类似消息的控制台上找到gi模块。

编辑: import gi在WinPython 3.3.2.3(32位)的IPython中运行。没有更多的时间来尝试从哪个版本不再起作用。下一步是让GTK + 3与cx_Freeze一起工作。

0 个答案:

没有答案