ModuleNotFoundError: No module named 'matplotlib_venn', when use Jupyterlab

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wangbingfengf98/article/details/88729758

when run below in mac

!pip install matplotlib
!pip install matplotlib-venn

only matplotlib installed.

use

$ conda list matplotlib*

to see if these two installed. 

$ easy_install matplotlib-venn

then I must reinstall matplotlib use easy_install command

$ easy_install matplotlib
# 这个 cell 集合运算图示需要安装 matplotlib 和 matplotlib-venn
# !pip install matplotlib
# !pip install matplotlib-venn

import matplotlib.pyplot as plt

from matplotlib_venn import venn2

admins = {'Moose', 'Joker', 'Joker'}
moderators = {'Ann', 'Chris', 'Jane', 'Moose', 'Zero'}

v = venn2(subsets=(admins, moderators), set_labels=('admins', 'moderators'))
v.get_label_by_id('11').set_text('\n'.join(admins & moderators))
v.get_label_by_id('10').set_text('\n'.join(admins - moderators))
v.get_label_by_id('01').set_text('\n'.join(admins ^ moderators))

plt.show()

references:

1. https://github.com/wangbingfeng/the-craft-of-selfteaching/blob/master/Part.1.E.6.containers.ipynb

2. https://pypi.org/project/matplotlib-venn/

3. https://stackoverflow.com/questions/52977346/anaconda-cant-import-installed-package-matplotlib-venn

猜你喜欢

转载自blog.csdn.net/wangbingfengf98/article/details/88729758