本文介绍了Ghost.py找不到PySide?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开始使用 Ghost.py Mac上的无头浏览器.我使用以下链接/命令安装了Ghost.py及其依赖项:

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. 针对Mac的Qt 5.0.1 ,具有GUI安装程序
  2. PySide 1.1.0 ,需要Qt Version >= 4.7.4,具有GUI安装程序
  3. sudo pip install Ghost.py
  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

我启动了Python,并确认我可以import PySide.但是,当我执行from ghost import Ghost时,找不到PySide :

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

通过执行import PySide; print PySide;,似乎在我的系统上的此处安装了PySide:/Library/Python/2.7/site-packages/PySide.因此,像这样附加PYTHONPATH:
export PYTHONPATH=$PYTHONPATH:/Library/Python/2.7/site-packages #for PySide.

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.

但是,Ghost.py仍然找不到PySide.

如何说服Ghost.py找到我的PySide安装?

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

环境:

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

推荐答案

我遇到了完全相同的问题,但设法解决了.方法如下:

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

  1. 在系统上卸载当前安装的PySide和qt.确保/Library/Python/2.7/site-packages中不存在PySide.
  2. 安装qt和PySide http://qt-project.org/wiki/PySide_Binaries_MacOSX .
  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:我的系统正在运行10.9(小牛),但我认为它也应该在10.7(Mountain Lion)中工作.

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

这篇关于Ghost.py找不到PySide?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 05:28