老铁们瞅一眼,看看是不是这个错

>>> from mpl_toolkits.basemap import Basemap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/Quella/anaconda3/lib/python3.7/site-packages/mpl_toolkits/basemap/__init__.py", line 155, in <module>
    pyproj_datadir = os.environ['PROJ_LIB']
  File "/home/Quella/anaconda3/lib/python3.7/os.py", line 678, in __getitem__
    raise KeyError(key) from None
KeyError: 'PROJ_LIB'

我在matplotlib的github瞅了瞅,没细看,找到了这个:
clipboard.png

一部分人说是你conda的用法不对,另一部分人说是环境变量的问题,我没管那么多,能用就行,每次运行:

from mpl_toolkits.basemap import Basemap

之前
先运行

import os
import conda

conda_file_dir = conda.__file__
conda_dir = conda_file_dir.split('lib')[0]
proj_lib = os.path.join(os.path.join(conda_dir, 'share'), 'proj')
os.environ["PROJ_LIB"] = proj_lib

from mpl_toolkits.basemap import Basemap

不过照这段代码看,他就是添加了个环境变量,倒是可以试着直接改环境变量,我没管......以后有缘的话再改吧......论文狗先滚了......

clipboard.png

github原地址:
https://github.com/conda-forg...
https://github.com/matplotlib...


王尼玛
373 声望13 粉丝

此号作废!