0

I just wrote a python code on Spyder and Jupiter, I get the same problem in the console:

File "C:\Users\Ahmed\OneDrive\Bureau\Code3\A Japanese Journey.py", line 34, in <module>
from mpl_toolkits.basemap import Basemap
File "C:\ProgramData\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 155, in <module>
 pyproj_datadir = os.environ['PROJ_LIB']
 File "C:\ProgramData\Anaconda3\lib\os.py", line 678, in __getitem__
raise KeyError(key) from None
KeyError: 'PROJ_LIB'

Here's my code:

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
m = Basemap(projection='aeqd',width=2000000,height=2000000, lat_0=37.5, lon_0=138.2)
cx = [c[0] for c in kmeans.cluster_centers_]
cy = [c[1] for c in kmeans.cluster_centers_]
Edric
  • 24,639
  • 13
  • 81
  • 91
  • Does this answer your question? [Basemap import error in PyCharm — KeyError: 'PROJ\_LIB'](https://stackoverflow.com/questions/52295117/basemap-import-error-in-pycharm-keyerror-proj-lib) – wirthra May 05 '20 at 23:18
  • Yes, I saw the answer. I had to add the destination of the file to my code for it to work. Thank you. – Ahmed Ben Jemia May 06 '20 at 01:00

0 Answers0