So I am trying to run a simple matplotlib example in my virtualenv (in the console). Here's the code:
import matplotlib
matplotlib.use('GTKAgg')
import matplotlib.pyplot as plt
radius = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
area = [3.14159, 12.56636, 28.27431, 50.26544, 78.53975, 113.09724]
plt.plot(radius, area)
plt.show()
However, when I run this I get:
ImportError: Gtk* backend requires pygtk to be installed.
And now the fun starts. I tried to pip install pygtk but it throws:
********************************************************************
* Building PyGTK using distutils is only supported on windows. *
* To build PyGTK in a supported way, read the INSTALL file. *
********************************************************************
Complete output from command python setup.py egg_info:
********************************************************************
I have checked the INSTALL
file and says to try ./configfure; make; make install
. However. I am not quite sure how to do this within virtualenv. Where do I unpack the sources for pygtk in order to be installed within virtualenv.
question from:
https://stackoverflow.com/questions/9064289/installing-pygtk-in-virtualenv 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…