ImportError:DLL加载失败 - 尝试导入spynner时

时间:2014-04-21 01:30:26

标签: python import spynner

当我运行导入spynner的代码时,出现以下错误:

> python .\spynner-test.py
Traceback (most recent call last):
  File ".\spynner-test.py", line 10, in <module>
    import spynner
  File "C:\Anaconda\lib\site-packages\spynner\__init__.py", line 2, in <module>
    from browser import *
  File "C:\Anaconda\lib\site-packages\spynner\browser.py", line 56, in <module>
    from PyQt4.QtNetwork import QNetworkCookie, QNetworkAccessManager, QSslConfiguration, QSslCipher
ImportError: DLL load failed: The specified procedure could not be found.

一个有趣的事情是我可以在普通的python shell中导入这些东西而没有任何问题:

> python
Python 2.7.5 |Anaconda 1.9.2 (64-bit)| (default, Jul  1 2013, 12:37:52) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtNetwork import QNetworkCookie, QNetworkAccessManager, QSslConfiguration, QSslCipher
>>>

import spynner失败后,

> python
Python 2.7.5 |Anaconda 1.9.2 (64-bit)| (default, Jul  1 2013, 12:37:52) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import spynner
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda\lib\site-packages\spynner\__init__.py", line 2, in <module>
    from browser import *
  File "C:\Anaconda\lib\site-packages\spynner\browser.py", line 56, in <module>
    from PyQt4.QtNetwork import QNetworkCookie, QNetworkAccessManager, QSslConfiguration, QSslCipher
ImportError: DLL load failed: The specified procedure could not be found.
>>> from PyQt4.QtNetwork import QNetworkCookie, QNetworkAccessManager, QSslConfiguration, QSslCipher
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified procedure could not be found.
>>>

1 个答案:

答案 0 :(得分:0)

好吧我明白了。问题是spynner首先尝试导入PySide,从QSslConfiguration导入PyQt4.QtNetwork时出错。然后它切换到PyQt4,显然先前导入的PySide使PyQt4导入失败。当我删除try:中的browser.py部分时,我可以导入spynner