Install GDAL in virtualenvwrapper environment

后端 未结 3 1255
野趣味
野趣味 2021-02-04 09:06

I tried to install gdal (pip install gdal)in virtualenvwrapper environment but I got this error :

  error: command \'gcc\' failed with exit status 1

  ---------         


        
3条回答
  •  孤城傲影
    2021-02-04 09:42

    use pygdal

    pd@asghar:~$sudo apt-get install python3-gdal 
    
    pd@asghar:~$ virtualenv -p python3 test
    Running virtualenv with interpreter /usr/bin/python3
    Using base prefix '/usr'
    New python executable in /home/pd/test/bin/python3
    Also creating executable in /home/pd/test/bin/python
    Installing setuptools, pip, wheel...done.
    
    pd@asghar:~$  gdal-config --version
    2.1.3
    pd@asghar:~$ test/bin/pip install pygdal==2.1.3
    Collecting pygdal==2.1.3
      Could not find a version that satisfies the requirement pygdal==2.1.3 (from versions: 1.8.1.0, 1.8.1.1, 1.8.1.2, 1.8.1.3, 1.9.2.0, 1.9.2.1, 1.9.2.3, 1.10.0.0, 1.10.0.1, 1.10.0.3, 1.10.1.0, 1.10.1.1, 1.10.1.3, 1.11.0.0, 1.11.0.1, 1.11.0.3, 1.11.1.0, 1.11.1.1, 1.11.1.3, 1.11.2.1, 1.11.2.3, 1.11.3.3, 1.11.4.3, 1.11.5.3, 2.0.0.3, 2.0.1.3, 2.0.2.3, 2.0.3.3, 2.1.0.3, 2.1.1.3, 2.1.2.3, 2.1.3.3, 2.2.0.3)
    No matching distribution found for pygdal==2.1.3
    pd@asghar:~$ test/bin/pip install pygdal==2.1.3.3
    Collecting pygdal==2.1.3.3
    Collecting numpy>=1.0.0 (from pygdal==2.1.3.3)
      Using cached numpy-1.13.1-cp35-cp35m-manylinux1_x86_64.whl
    Installing collected packages: numpy, pygdal
    Successfully installed numpy-1.13.1 pygdal-2.1.3.3
    pd@asghar:~$ source test/bin/activate
    (test) pd@asghar:~$ python
    Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
    [GCC 5.4.0 20160609] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from osgeo import gdal
    >>> 
    

提交回复
热议问题