Unable to “import matplotlib.pyplot as plt” in virtualenv

前端 未结 7 1473
粉色の甜心
粉色の甜心 2020-12-04 07:39

I am working with flask in a virtual environment. I was able to install matplotlib with pip, and I can import matplotlib in a Python session. However, when I im

相关标签:
7条回答
  • 2020-12-04 08:10

    Although most answers seem to point towards patching the activate script to use the system python, I was having trouble getting that to work and an easy solution for me - though a little cringey - was to install matplotlib to the global environment and use that instead of a virtualenv instance. You can do this either by creating your virtualenv with the --system-site-packages flag like virtualenv --system-site-packages foo, or to use the universal flag when pip installing like pip install -U matplotlib.

    0 讨论(0)
提交回复
热议问题