Matplotlib doesn't display graph in virtualenv

后端 未结 5 882
予麋鹿
予麋鹿 2021-02-05 11:53

I have pip installed matplotlib in my virtualenv and I am trying to plot a simple graph. I use Eclipse and PyDev. When I run the script from Eclipse it doesn\'t display any grap

5条回答
  •  青春惊慌失措
    2021-02-05 12:48

    If you have a version of matplotlib installed on your system version of python, then you can link to the system version of matplotlib. On my machine I did the following:

    cd $VIRTUAL_ENV/lib/python2.7/site-packages
    ln -s /usr/lib/pymodules/python2.7/matplotlib .
    ln -s /usr/lib/pymodules/python2.7/matplotlib-1.1.1rc .
    

    This avoids many of the problems with getting matplotlib to work in the virtualenv but limits you to using the system version of matplotlib (which on this machine is not too bad).

    This method also allows you to use the --no-site-packages, but still have matplotlib work for you.

提交回复
热议问题