import matplotlib.pylot as plt
即便使用了ENV也报错,不同ENV运行都报此错误:
导入matplotlib时出错:
File “C:\Users\barre\PycharmProjects\dogs_cats\main.py”, line 23, in
import matplotlib.pyplot as plt File
“C:\Users\sunxp\AppData\Roaming\Python\Python37\site-
packages\matplotlib_init_.py”, line 105, in from
packaging.version import parse as parse_version ModuleNotFoundError:
No module named ‘packaging.version’
解决方法:
可以直接将C盘下site-packages的目录删除即可:
因为该目录会被首先调用,而虚拟环境下的site-packages就会被取代,从而造成版本冲突的错误。
C:\Users\sunxp\AppData\Roaming\Python\Python37\site-packages\