Install GDAL on Python 2.7 on a Amazon Linux virtual server

╄→尐↘猪︶ㄣ 提交于 2019-12-03 21:13:44

Its in the EPEL respository. Try this:

sudo yum-config-manager --enable epel
sudo yum install gdal-python
sudo yum -y update
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel
cd /tmp
curl -L http://download.osgeo.org/gdal/2.0.0/gdal-2.0.0.tar.gz | tar zxf -
cd gdal-2.0.0/
./configure --prefix=/usr/local --with-python
make -j4
sudo make install
sudo easy_install GDAL
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
sudo ldconfig

I was able to get this to work on a fresh t2.micro running amazon linux. The final export needs to be made permanent in bash script or the relevant place depending on your needs.

Following this I was able to from osgeo import gdal

You can make clean in the /tmp/gdal-2.0.0 folder to free up some space when done.

Warn - Build took a long time on a t2.micro

I followed this link on my EC2 instance (m4.large) which has Amazon Linux and python 2.7. It worked perfectly for me (I changed Gdal 2.0.0 to 2.2.0). Just make sure you have all the dependencies (ie numpy and libgdal). Let me know if you have any questions!

Nix package manager worked for me:

curl https://nixos.org/nix/install | sh
. /home/ec2-user/.nix-profile/etc/profile.d/nix.sh
nix-env -i gdal
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!