[英]Pyqtgraph error when running built in examples
我正在嘗試研究如何使用pyqtgraph以便我可以使用它。
我試過運行我在pyqtgraph網站上找到的這段代碼
import pyqtgraph.examples
pyqtgraph.examples.run()
但它總是拋出這個錯誤
Traceback (most recent call last):
File "/Users/willemhandreck/Code/Misc.Projects/heater_alert/python/plotly_test.py", line 1, in <module>
import pyqtgraph.examples
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyqtgraph/__init__.py", line 13, in <module>
from .Qt import QtGui
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyqtgraph/Qt.py", line 35, in <module>
from PySide import QtGui, QtCore, QtOpenGL, QtSvg
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PySide/QtGui.so, 2): Library not loaded: libpyside-python2.7.1.2.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PySide/QtGui.so
Reason: image not found
我該如何解決這個問題?
是的,如果我嘗試在mac上使用內置python,這里也是同樣的問題。
我的解決方案是使用anaconda python發行版:
1)下載並安裝Anaconda python,它已經安裝了所有正確的科學模塊。 http://continuum.io/downloads#all
2)重新啟動終端並確保你的anaconda是你的python:
$ which python
/Users/caleb/anaconda/bin/python
3)然后安裝pyqtgraph:
$ pip install pyqtgraph
...
Successfully installed pyqtgraph-0.9.10
4)從命令行運行示例:
$ python -m pyqtgraph.examples
或使用上面的import ... run方法。
-Caleb
這實際上是件好事。 系統python已安裝並配置為運行系統實用程序。 對於特殊包裝,調整,升級和實驗,有一個單獨的圍欄是個好主意。 Anaconda通過將自身及其包裝都包含在自己的目錄中使其自動化,並防止弄亂其他任何東西。
http://www.reddit.com/r/Python/comments/39qeq6/anaconda_pros_cons_mac_os_x/cs5mxwk
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.