python安装gdal的两种方法

1.不用手动下载文件,直接执行以下命令即可

conda install gdal

2.首先,下载gdal的whl文件  链接, 官网下载比较慢,GDAL-2.2.4-cp27-cp27m-win_amd64.whl

链接: https://pan.baidu.com/s/1prPHLJKwoKK505i5qTVZ7g

提取码: egj6

有百度云可以下载,然后放入本机目录。

这里目录有两种,一是放入anaconda安装目录的Scripts目录,我的是D:\anaconda\Scripts目录;二是放入Anaconda环境的Scripts目录,我的是D:\anaconda\envs\uav\Scripts(uav是我自己的环境,可通过命令conda create -n name python=3.6创建环境)。

最后,在D:\Anaconda3\Scripts目录下在空白处按住shift加右键打开cmd,输入以下命令即可。

pip install GDAL‑3.0.1‑cp38‑cp38‑win_amd64.whl

注:若用pip安装gdal会报错:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gdal

报错信息如下:

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting gdal
 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/26/c6/f8846ba726b37f9a1099acb5bff43c309fb913577674c1ba491f6fc60598/GDAL-3.0.1.tar.gz (576kB)
  |████████████████████████████████| 583kB 810kB/s
Building wheels for collected packages: gdal
 Building wheel for gdal (setup.py) ... error
 ERROR: Complete output from command /home/dennis/miniconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-i321u6em/gdal/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-aaneihet --python-tag cp37:
 ERROR: running bdist_wheel
 running build
 running build_py
 creating build
 creating build/lib.linux-x86_64-3.7
 copying gdal.py -> build/lib.linux-x86_64-3.7
 copying ogr.py -> build/lib.linux-x86_64-3.7
 copying osr.py -> build/lib.linux-x86_64-3.7
 copying gdalconst.py -> build/lib.linux-x86_64-3.7
 copying gdalnumeric.py -> build/lib.linux-x86_64-3.7
 creating build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/osr.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/gnm.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/__init__.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/ogr.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/gdal.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.7/osgeo
 Fixing build/lib.linux-x86_64-3.7/gdal.py build/lib.linux-x86_64-3.7/ogr.py build/lib.linux-x86_64-3.7/osr.py build/lib.linux-x86_64-3.7/gdalconst.py build/lib.linux-x86_64-3.7/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/gdalconst.py build/lib.linux-x86_64-3.7/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/osr.py build/lib.linux-x86_64-3.7/osgeo/gnm.py build/lib.linux-x86_64-3.7/osgeo/__init__.py build/lib.linux-x86_64-3.7/osgeo/ogr.py build/lib.linux-x86_64-3.7/osgeo/gdal.py build/lib.linux-x86_64-3.7/osgeo/gdal_array.py
 Skipping optional fixer: ws_comma
 Fixing build/lib.linux-x86_64-3.7/gdal.py build/lib.linux-x86_64-3.7/ogr.py build/lib.linux-x86_64-3.7/osr.py build/lib.linux-x86_64-3.7/gdalconst.py build/lib.linux-x86_64-3.7/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/gdalconst.py build/lib.linux-x86_64-3.7/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/osr.py build/lib.linux-x86_64-3.7/osgeo/gnm.py build/lib.linux-x86_64-3.7/osgeo/__init__.py build/lib.linux-x86_64-3.7/osgeo/ogr.py build/lib.linux-x86_64-3.7/osgeo/gdal.py build/lib.linux-x86_64-3.7/osgeo/gdal_array.py
 Skipping optional fixer: ws_comma
 running build_ext
 gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/miniconda3/include/python3.7m -I/home/dennis/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/home/dennis/miniconda3/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
 gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/miniconda3/include/python3.7m -I/home/dennis/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/home/dennis/miniconda3/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o -std=c++11
 building 'osgeo._gdal' extension
 creating build/temp.linux-x86_64-3.7
 creating build/temp.linux-x86_64-3.7/extensions
 gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/miniconda3/include/python3.7m -I/home/dennis/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/home/dennis/miniconda3/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.7/extensions/gdal_wrap.o -std=c++11 -I/home/dennis/miniconda3/include
 cc1plus: warning: command line option ‘-Wstrict-prototypes' is valid for C/ObjC but not for C++
 extensions/gdal_wrap.cpp:4075:1: error: ‘VSIDIR' does not name a type
 VSIDIR* wrapper_VSIOpenDir( const char * utf8_path,
 ^
 extensions/gdal_wrap.cpp:4123:38: error: ‘VSIDIR' was not declared in this scope
 DirEntry* wrapper_VSIGetNextDirEntry(VSIDIR* dir)
          ^
 extensions/gdal_wrap.cpp:4123:46: error: ‘dir' was not declared in this scope
 DirEntry* wrapper_VSIGetNextDirEntry(VSIDIR* dir)
            ^
 extensions/gdal_wrap.cpp:4124:1: error: expected ‘,' or ‘;' before ‘{' token
 {
 ^
 extensions/gdal_wrap.cpp:3225:7: warning: ‘char* get_aligned_buffer(char*, GDALDataType)' defined but not used [-Wunused-function]
 char* get_aligned_buffer(char* data, GDALDataType ntype)
   ^
 extensions/gdal_wrap.cpp:3244:13: warning: ‘void update_buffer_size(void*, char*, char*, size_t)' defined but not used [-Wunused-function]
 static void update_buffer_size(void* obj, char* data, char* data_aligned, size_t buf_size)
    ^
 extensions/gdal_wrap.cpp:3299:5: warning: ‘int GetUseExceptions()' defined but not used [-Wunused-function]
 int GetUseExceptions() {
  ^
 extensions/gdal_wrap.cpp:3305:6: warning: ‘void UseExceptions()' defined but not used [-Wunused-function]
 void UseExceptions() {
  ^
 extensions/gdal_wrap.cpp:3322:6: warning: ‘void DontUseExceptions()' defined but not used [-Wunused-function]
 void DontUseExceptions() {
  ^
 extensions/gdal_wrap.cpp:3370:13: warning: ‘void ClearErrorState()' defined but not used [-Wunused-function]
 static void ClearErrorState()
    ^
 error: command 'gcc' failed with exit status 1
 ----------------------------------------
 ERROR: Failed building wheel for gdal
 Running setup.py clean for gdal
Failed to build gdal
Installing collected packages: gdal
 Running setup.py install for gdal ... error
 ERROR: Complete output from command /home/dennis/miniconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-i321u6em/gdal/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-axykekqk/install-record.txt --single-version-externally-managed --compile:
 ERROR: running install
 running build
 running build_py
 creating build
 creating build/lib.linux-x86_64-3.7
 copying gdal.py -> build/lib.linux-x86_64-3.7
 copying ogr.py -> build/lib.linux-x86_64-3.7
 copying osr.py -> build/lib.linux-x86_64-3.7
 copying gdalconst.py -> build/lib.linux-x86_64-3.7
 copying gdalnumeric.py -> build/lib.linux-x86_64-3.7
 creating build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/osr.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/gnm.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/__init__.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/ogr.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/gdal.py -> build/lib.linux-x86_64-3.7/osgeo
 copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.7/osgeo
 Fixing build/lib.linux-x86_64-3.7/gdal.py build/lib.linux-x86_64-3.7/ogr.py build/lib.linux-x86_64-3.7/osr.py build/lib.linux-x86_64-3.7/gdalconst.py build/lib.linux-x86_64-3.7/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/gdalconst.py build/lib.linux-x86_64-3.7/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/osr.py build/lib.linux-x86_64-3.7/osgeo/gnm.py build/lib.linux-x86_64-3.7/osgeo/__init__.py build/lib.linux-x86_64-3.7/osgeo/ogr.py build/lib.linux-x86_64-3.7/osgeo/gdal.py build/lib.linux-x86_64-3.7/osgeo/gdal_array.py
 Skipping optional fixer: ws_comma
 Fixing build/lib.linux-x86_64-3.7/gdal.py build/lib.linux-x86_64-3.7/ogr.py build/lib.linux-x86_64-3.7/osr.py build/lib.linux-x86_64-3.7/gdalconst.py build/lib.linux-x86_64-3.7/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/gdalconst.py build/lib.linux-x86_64-3.7/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/osr.py build/lib.linux-x86_64-3.7/osgeo/gnm.py build/lib.linux-x86_64-3.7/osgeo/__init__.py build/lib.linux-x86_64-3.7/osgeo/ogr.py build/lib.linux-x86_64-3.7/osgeo/gdal.py build/lib.linux-x86_64-3.7/osgeo/gdal_array.py
 Skipping optional fixer: ws_comma
 running build_ext
 gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/miniconda3/include/python3.7m -I/home/dennis/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/home/dennis/miniconda3/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
 gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/miniconda3/include/python3.7m -I/home/dennis/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/home/dennis/miniconda3/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o -std=c++11
 building 'osgeo._gdal' extension
 creating build/temp.linux-x86_64-3.7
 creating build/temp.linux-x86_64-3.7/extensions
 gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/miniconda3/include/python3.7m -I/home/dennis/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/home/dennis/miniconda3/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.7/extensions/gdal_wrap.o -std=c++11 -I/home/dennis/miniconda3/include
 cc1plus: warning: command line option ‘-Wstrict-prototypes' is valid for C/ObjC but not for C++
 extensions/gdal_wrap.cpp:4075:1: error: ‘VSIDIR' does not name a type
  VSIDIR* wrapper_VSIOpenDir( const char * utf8_path,
  ^
 extensions/gdal_wrap.cpp:4123:38: error: ‘VSIDIR' was not declared in this scope
  DirEntry* wrapper_VSIGetNextDirEntry(VSIDIR* dir)
           ^
 extensions/gdal_wrap.cpp:4123:46: error: ‘dir' was not declared in this scope
  DirEntry* wrapper_VSIGetNextDirEntry(VSIDIR* dir)
             ^
 extensions/gdal_wrap.cpp:4124:1: error: expected ‘,' or ‘;' before ‘{' token
  {
  ^
 extensions/gdal_wrap.cpp:3225:7: warning: ‘char* get_aligned_buffer(char*, GDALDataType)' defined but not used [-Wunused-function]
  char* get_aligned_buffer(char* data, GDALDataType ntype)
   ^
 extensions/gdal_wrap.cpp:3244:13: warning: ‘void update_buffer_size(void*, char*, char*, size_t)' defined but not used [-Wunused-function]
  static void update_buffer_size(void* obj, char* data, char* data_aligned, size_t buf_size)
     ^
 extensions/gdal_wrap.cpp:3299:5: warning: ‘int GetUseExceptions()' defined but not used [-Wunused-function]
  int GetUseExceptions() {
   ^
 extensions/gdal_wrap.cpp:3305:6: warning: ‘void UseExceptions()' defined but not used [-Wunused-function]
  void UseExceptions() {
   ^
 extensions/gdal_wrap.cpp:3322:6: warning: ‘void DontUseExceptions()' defined but not used [-Wunused-function]
  void DontUseExceptions() {
   ^
 extensions/gdal_wrap.cpp:3370:13: warning: ‘void ClearErrorState()' defined but not used [-Wunused-function]
  static void ClearErrorState()
     ^
 error: command 'gcc' failed with exit status 1
 ----------------------------------------
ERROR: Command "/home/dennis/miniconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-i321

总结

以上所述是小编给大家介绍的python安装gdal的两种方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

(0)

相关推荐

  • 在python中利用GDAL对tif文件进行读写的方法

    利用GDAL库对tif影像进行读取 示例代码默认波段为[B.G.R.NIR的顺序,且为四个波段] import gdal def readTif(fileName): dataset = gdal.Open(fileName) if dataset == None: print(fileName+"文件无法打开") return im_width = dataset.RasterXSize #栅格矩阵的列数 im_height = dataset.RasterYSize #栅格矩阵的行

  • 利用python GDAL库读写geotiff格式的遥感影像方法

    如下所示: from osgeo import gdal import numpy as np def read_tiff(inpath): ds=gdal.Open(inpath) row=ds.RasterXSize col=ds.RasterYSize band=ds.RasterCount geoTransform=ds.GetTransform() proj=ds.GetTransform() data=np.zeros([row,col,band]) for i in range(b

  • Python空间数据处理之GDAL读写遥感图像

    GDAL是空间数据处理的开源包,支持多种数据格式的读写.遥感图像是一种带大地坐标的栅格数据,遥感图像的栅格模型包含以下两部分的内容: 栅格矩阵:由正方形或者矩形栅格点组成,每个栅格点所对应的数值为该点的像元值,在遥感图像中用于表示地物属性值:遥感图像有单波段与多波段,波段表示地物属性的种类,每个波段表示地物一种属性. 大地坐标:空间数据参考表示地图的投影信息:仿射矩阵能将行列坐标映射到面坐标上. GDAL读写遥感数据的代码: from osgeo import gdal import os cl

  • python gdal安装与简单使用

    gdal安装 方式一:在网址 https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal 下载对应python版本的whl文件,在命令行中pip install whl文件完整路径安装(windows方式). 方式二: 命令行conda/pip search gdal查看版本,选择合适的版本(我的2.2.4),如果没有,使用方式一. 命令行conda/pip install gdal=版本号,注意加上版本号,否则可能安装上老版本(windows/linux都

  • Python的地形三维可视化Matplotlib和gdal使用实例

    我是以Python开门的,我还是觉得Python也可以进行地形三维可视化,当然这里需要借助第三方库,so,我就来介绍:Python一个很重要可视化插件,Matplotlib. Matplotlib是Python最著名的绘图库,它提供了一整套友好的命令,十分适合交互式地进行制图.而且也可以方便地将它作为绘图控件,嵌入GUI应用程序中.你会发现Matplotlib和matlab相似,但是你知道matlab强大是很强大,但是安装包就有7G,一下就让我失去玩弄他的兴趣. Matplotlib的二维图形非

  • 对Python3+gdal 读取tiff格式数据的实例讲解

    1.遇到的问题:numpy版本 im_data = dataset.ReadAsArray(0,0,im_width,im_height)#获取数据 这句报错 升级numpy:pip install -U numpy 但是提示已经是最新版本 解决:卸载numpy 重新安装 2.直接从压缩包中读取tiff图像 参考:http://gdal.org/gdal_virtual_file_systems.html#gdal_virtual_file_systems_vsizip 当前情况是2层压缩: /

  • python安装gdal的两种方法

    1.不用手动下载文件,直接执行以下命令即可 conda install gdal 2.首先,下载gdal的whl文件  链接, 官网下载比较慢,GDAL-2.2.4-cp27-cp27m-win_amd64.whl 链接: https://pan.baidu.com/s/1prPHLJKwoKK505i5qTVZ7g 提取码: egj6 有百度云可以下载,然后放入本机目录. 这里目录有两种,一是放入anaconda安装目录的Scripts目录,我的是D:\anaconda\Scripts目录:二

  • Ubuntu 安装 JDK8 的两种方法(总结)

    ubuntu 安装jdk 的两种方法总结: 1:通过ppa(源) 方式安装. 2:通过官网下载安装包安装. 这里推荐第1种,因为可以通过 apt-get upgrade 方式方便获得jdk的升级 使用ppa/源方式安装 1.添加ppa sudo add-apt-repository ppa:webupd8team/java sudo apt-get update 2.安装oracle-java-installer jdk8 sudo apt-get install oracle-java8-in

  • Python更新数据库脚本两种方法及对比介绍

    最近项目的两次版本迭代中,根据业务需求的变化,需要对数据库进行更新,两次分别使用了不同的方式进行更新. 第一种:使用python的MySQLdb模块利用原生的sql语句进行更新 import MySQLdb #主机名 HOST = '127.0.0.1' #用户名 USER = "root" #密码 PASSWD = "123456" #数据库名 DB = "db_name" # 打开数据库连接 db=MySQLdb.connect(HOST,U

  • python安装pillow的三种方法

    目录 第一种方法 第二种方法 第三种方法 安装pillow(python的图形界面库) 第一种方法 在Dos界面输入pip install pillow(但是不知为何总是失败):搞了好几次都没成功 第二种方法 在   https://pypi.org/  中找到对应的pillow(包括版本windows.python3.6) 再在Dos界面输入 pip install Pillow-6.1.0-cp36-cp36m-win_amd64.whl 安装即可 第三种方法 用豆瓣提供的源 pip ins

  • Python读取视频的两种方法(imageio和cv2)

    用python读取视频有两种主要方法,大家可依据自己的需求进行使用. 方法一: 使用imageio库,没有安装的可用pip安装或自己下载,安装好后重启终端即可调用. import pylab import imageio #视频的绝对路径 filename = '/path/to/your/video.mp4' #可以选择解码工具 vid = imageio.get_reader(filename, 'ffmpeg') for im in enumerate(vid): #image的类型是ma

  • Python读取视频的两种方法(imageio和cv2)

    用python读取视频有两种主要方法,大家可依据自己的需求进行使用. 方法一: 使用imageio库,没有安装的可用pip安装或自己下载,安装好后重启终端即可调用. import pylab import imageio #视频的绝对路径 filename = '/path/to/your/video.mp4' #可以选择解码工具 vid = imageio.get_reader(filename, 'ffmpeg') for im in enumerate(vid): #image的类型是ma

  • 总结python实现父类调用两种方法的不同

    python中有两种方法可以调用父类的方法: super(Child, self).method(args) Parent.method(self, args) 我用其中的一种报了如下错误: 找不到 classobj.当我把调用改为 super(B, self).f(name) 就能正确运行,且结果正确. 分析错误 因为基类没有继承 object , 在python中,一个可以这样创建: class A: pass 也可以这样创建: class A(object): pass 这两者的区别就是:

  • python list排序的两种方法及实例讲解

    对List进行排序,Python提供了两个方法 方法1.用List的内建函数list.sort进行排序 list.sort(func=None, key=None, reverse=False) Python实例: >>> list = [2,5,8,9,3] >>> list [2,5,8,9,3] >>> list.sort() >>> list [2, 3, 5, 8, 9] 方法2.用序列类型函数sorted(list)进行排

  • linux服务器上安装jdk的两种方法(yum+下载包)

    前言 对于开发者来说,安装jdk按理说是非常简单的事,但在linux下安装着实费了我这个一直玩windows的小白不少劲.这里简单把步骤梳理下,希望能帮助像我这样的纯小白人士少踩点坑. 这里介绍两种安装方式: 1.yum安装: 2.从官网下载包安装 一.获得一台linux服务器 要在linux下安装jdk,首先你得先有一台linux服务器,作为小白,手头的机器肯定都是windows的,搞个虚拟机安装对我这种小白简直是折磨人:这里使用最简单的方式获得一台linux服务器,就是从阿里云上租一台.镜像

  • centos7安装nginx的两种方法介绍

    centos7安装nginx 第一种方式:通过yum安装 直接通过 yum install nginx 肯定是不行的,因为yum没有nginx,所以首先把 nginx 的源加入 yum 中. 运行下面的命令: 1.将nginx放到yum repro库中 复制代码 代码如下: [root@localhost ~]# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noa

随机推荐