Ghost.py not finding PySide?

爷,独闯天下 提交于 2019-12-23 16:07:40

问题


I'm trying to get started with the Ghost.py headless browser on a Mac. I installed Ghost.py and its dependencies using these links/commands:

  1. Qt 5.0.1 for Mac, has a GUI installer
  2. PySide 1.1.0, which requires Qt Version >= 4.7.4, has a GUI installer
  3. sudo pip install Ghost.py

I launched Python, and confirmed that I can import PySide. However, when I do from ghost import Ghost, it fails to find PySide:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ghost/__init__.py", line 1, in <module>
    from ghost import Ghost
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ghost/ghost.py", line 28, in <module>
    raise Exception("Ghost.py requires PySide or PyQt")
Exception: Ghost.py requires PySide or PyQt

By doing import PySide; print PySide;, it appears that PySide is installed here on my system: /Library/Python/2.7/site-packages/PySide. So, appended the PYTHONPATH like this:
export PYTHONPATH=$PYTHONPATH:/Library/Python/2.7/site-packages #for PySide.

However, Ghost.py still cannot find PySide.

How can I convince Ghost.py to find my installation of PySide?


Environment:

  • Mac OS X 10.7.5
  • Python 2.7
  • Qt 5.0.1
  • PySide 1.1.0

回答1:


I faced the exact same problem but managed to fix it. Here is how:

  1. Uninstall the current installation of PySide and qt on your system. Make sure PySide is not present in /Library/Python/2.7/site-packages.
  2. Install qt and PySide from http://qt-project.org/wiki/PySide_Binaries_MacOSX.

PS: My system is running 10.9 (Mavericks) but I think it should work in 10.7 (Mountain Lion) as well.



来源:https://stackoverflow.com/questions/15047426/ghost-py-not-finding-pyside

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!