Shiboken cannot be imported

2019-07-27 22:15发布

问题:

Because of issues discussed at this answer, I want to import the shiboken module. When I try import shiboken, I just get an ImportError. But my site-packages directory actually has a Shiboken (capital S) folder, and I am able to import Shiboken fine. Unfortunately, this doesn't have any of the methods the shiboken module is meant to have (e.g., isValid). Just to verify, when I run Shiboken.isValid(), I get:

AttributeError: 'module' object has no attribute 'isValid'.

Based on a related post, perhaps I just don't have things installed correctly. But when I enter:

pip install --use-wheel -U shiboken

I get:

Requirement already up-to-date: shiboken in c:\anaconda\lib\site-packages

So it seems I already have it installed.

Note: this may be a special case of this issue:

PySide's shiboken python module not found


I am using Python 2.7.6, distributed under Anaconda, in Windows 7, with Qt 4.8.5/PySide 1.2.2.

回答1:

Don't know if you fixed it already; I had the same problem, can you try

from Shiboken import shiboken


标签: python qt pyside