Ubuntu18.4—GDAL
Posted gispathfinder
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu18.4—GDAL相关的知识,希望对你有一定的参考价值。
1.关闭SELinux
sudo apt-get install apparmor-profiles
sudo reboot
sudo systemctl stop apparmor-profiles
2.关闭防火墙
sudo ufw enable
3.安装Python3
[email protected]:/usr/bin$ sudo ln -s python3 python
sudo apt-get install python3
4.设定apt源
#备份
cp /etc/apt/sources.list /etc/apt/sources.list.bak
在/etc/apt/sources.list文件前面添加如下条目
#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
最后执行如下命令更新源
##更新
sudo apt-get update
sudo apt-get upgrade
5.安装GDAL
sudo apt-get install libgdal-dev
sudo apt-get install gdal-bin
sudo apt-get install libgeos++-dev
sudo apt-get install libgeos
sudo apt-get install libgeos-dev
sudo apt-get install libgeotiff-dev
sudo apt-get install libgeotiff-epsg
sudo apt-get install libgeotiff2
sudo apt-get install libotb-dev
sudo apt-get install libsaga
sudo apt-get install libsaga-dev
sudo apt-get install libsaga-api
sudo apt-get install libsaga-gdi
sudo apt-get install mapserver-bin
sudo apt-get install cgi-mapserver
sudo apt-get install mapserver-doc
6.安装Python3-gdal
sudo apt-get install python3-pip
sudo apt-get install python3-pillow
sudo apt-get install python3-numpy
sudo apt-get install python3-matplotlib
sudo apt-get install python3-gdal
sudo apt-get install python3-shapely
sudo apt-get install python3-polygon3
sudo apt-get install python3-rtree
sudo apt-get install python3-pysal
sudo apt-get install python3-rasterio
sudo apt-get install python3-otb
sudo apt-get install python-saga
sudo apt-get install python-mapscript
7.另外安装
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple python_dateutil
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple protobuf
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple Pillow
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pyparsing
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple kiwisolver
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pyproj
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple Shapely
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
gdal-config --version
export CFLAGS=$(gdal-config --cflags)
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple --global-option=build_ext --global-option="-I/usr/include/gdal/" gdal==2.2.3
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple Polygon3
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple Rtree
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
以上是关于Ubuntu18.4—GDAL的主要内容,如果未能解决你的问题,请参考以下文章
无法重新启动 mysql.service:从 18.4 升级后,单元 mysql.service 在 Ubuntu 20.04 中被屏蔽