老鐵們瞅一眼,看看是否是這個錯python
>>> 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瞅了瞅,沒細看,找到了這個:
git
一部分人說是你conda的用法不對,另外一部分人說是環境變量的問題,我沒管那麼多,能用就行,每次運行:github
from mpl_toolkits.basemap import Basemap
以前
先運行spa
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
不過照這段代碼看,他就是添加了個環境變量,卻是能夠試着直接改環境變量,我沒管......之後有緣的話再改吧......論文狗先滾了......code
github原地址:
https://github.com/conda-forg...
https://github.com/matplotlib...blog