简体   繁体   中英

AttributeError: module 'pyproj' has no attribute 'pyproj_datadir'

Have had a nightmare downloading basemap, have had so many errors and fixing them, but yet another shows up. I now keep getting the following error:

Using spyder I write:

from mpl_toolkits.basemap import Basemap

And it outputs:

 File "/anaconda3/lib/python3.7/site-packages/mpl_toolkits/basemap/__init__.py", 
line 152, in <module>
    epsgf = open(os.path.join(pyproj.pyproj_datadir,'epsg'))

AttributeError: module 'pyproj' has no attribute 'pyproj_datadir'

I tried:

pip install pyproj==1.9.6

but within a large amount of text a line in red says:

Failed building wheel for pyproj

i was working through the same nightmare of installing basemap in Windows and for this error your fix with

pip install pyproj==1.9.6

worked for me, but I had to close Spyder (or Jupyter or any IDE). Having it open gave a Permission Error during the pip install. I got this from this post: Python - PIP install trouble shooting - PermissionError: [WinError 5] Access is denied

Just ran into that issue as well; however I did not need to downgrade pyproj to v1.9.6. Instead, after closing Spyder (!), I used the whl file of the most recent version built by Christoph Gohlke which you can find here .

By the way, I'm using basemap and shapely whl files from there as well to install these packages (all the most recent version for my current Python installation.

Windows 10, Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)].

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM