简体   繁体   中英

Installing GDAL locally: can't import numpy

Trying to set up geodjango locally, but getting an error: Brewed Python cannot import numpy

But I can import numpy in the interpreter:

Python 2.7.5 (default, Oct 27 2013, 12:25:46) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.7.1'

Why can't I brew install gdal ?

admins-macbook:lib Admin$ brew install gdal
gdal: Unsatisfied dependency: numpy
Brewed Python cannot `import numpy`. Install with:
  pip-2.7 install numpy
Error: An unsatisfied requirement failed this build.

admins-macbook:lib Admin$ pip-2.7 install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in ./python2.7/site-packages
Cleaning up...

Thanks for any ideas that might help me get geodjango working locally!

Check which Python is actually being called. It's likely you are using one Python to check by hand for 'import numpy' but the other is being called during the brew install.

Try changing your path to include /usr/bin at the front, like so:

PATH=/usr/bin:$PATH

I'm in the middle of doing this and doing an upgrade to Python 2.7.5 as well, will check back in to see if the 'brew install gdal' benefits from this.

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