底图和 Fiona 不会安装用于处理 iPython 笔记本中的地图和 shp 文件
Basemap and Fiona won't install for processing of maps & shp files in iPython Notebook
我是 python 的一名相对较新的学生,仍在寻找自己的出路
大约。我通常通过堆栈溢出很快找到答案,但是
这个让我难住了
我根本无法获得用于 ipython 笔记本的形状和地图文件。
我似乎无法安装底图或 fiona
命令如下:
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.colors import Normalize
from matplotlib.collections import PatchCollection
from mpl_toolkits.basemap import Basemap
from shapely.geometry import Point, Polygon, MultiPoint, MultiPolygon
from shapely.prepared import prep
from pysal.esda.mapclassify import Natural_Breaks as nb
from descartes import PolygonPatch
import fiona
from itertools import chain
错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-120-17f76aeda5fd> in <module>()
3 from matplotlib.colors import Normalize
4 from matplotlib.collections import PatchCollection
----> 5 from mpl_toolkits.basemap import Basemap
6 from shapely.geometry import Point, Polygon, MultiPoint, MultiPolygon
7 from shapely.prepared import prep
ImportError: No module named 'mpl_toolkits.basemap'
fiona 和其他组件出现类似错误。请问我做错了什么?
我过去安装过 matplotlib 和其他组件没有问题我试过这样使用 pip 命令:
!conda install basemap
!pip install pyshp
!pip install fiona
!pip install descartes
输出:
Using Anaconda Cloud api site https://api.anaconda.org
...The following specifications were found to be in conflict:
- basemap -> matplotlib
- basemap -> numpy 1.10*|1.7*|1.8*|1.9*
- basemap -> python 2.7*
- conda -> conda-env *|<2.5|>=2.5.0
- conda -> menuinst
- conda -> pycosat
- conda -> python 2.7*
- conda -> pyyaml
- conda -> requests
- conda-env (target=conda-env-2.4.5-py35_0.tar.bz2) -> python 2.7*|3.3*|3.4*|3.5*
- cycler (target=cycler-0.10.0-py35_0.tar.bz2) -> python 2.7*|3.4*|3.5*
- cycler (target=cycler-0.10.0-py35_0.tar.bz2) -> six
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> numpy 1.10*|1.11*|1.6*|1.7*|1.8*|1.9*
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> pyqt
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> python-dateutil
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> pytz
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> tk 8.5.*
- menuinst (target=menuinst-1.3.2-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- mkl-service (target=mkl-service-1.1.2-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- nose (target=nose-1.3.7-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- numexpr (target=numexpr-2.5-np110py35_0.tar.bz2) -> numpy 1.11*|1.6*
- numexpr (target=numexpr-2.5-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- numpy (target=numpy-1.10.4-py35_0.tar.bz2) -> nose
- numpy (target=numpy-1.10.4-py35_0.tar.bz2) -> python 2.7*
- pip (target=pip-8.1.1-py35_1.tar.bz2) -> python 2.7*
- pycosat (target=pycosat-0.6.1-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- pyparsing (target=pyparsing-2.0.3-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- pyqt (target=pyqt-4.11.4-py35_5.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- pyqt (target=pyqt-4.11.4-py35_5.tar.bz2) -> qt >=4.8.6|>=4.8.7
- pyqt (target=pyqt-4.11.4-py35_5.tar.bz2) -> sip >=4.16.4
- python 3.5*
- python-dateutil (target=python-dateutil-2.5.1-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- pytz (target=pytz-2016.2-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- pyyaml (target=pyyaml-3.11-py35_3.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- qt (target=qt-4.8.7-vc14_7.tar.bz2) -> @vc10
- qt (target=qt-4.8.7-vc14_7.tar.bz2) -> @vc14
- qt (target=qt-4.8.7-vc14_7.tar.bz2) -> @vc9
- requests (target=requests-2.9.1-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- scikit-learn (target=scikit-learn-0.17.1-np110py35_0.tar.bz2) -> nose
- scikit-learn (target=scikit-learn-0.17.1-np110py35_0.tar.bz2) -> numpy 1.11*|1.6*
- scikit-learn (target=scikit-learn-0.17.1-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- scikit-learn (target=scikit-learn-0.17.1-np110py35_0.tar.bz2) -> scipy
- scipy (target=scipy-0.17.0-np110py35_0.tar.bz2) -> numpy 1.11*|1.6*
- scipy (target=scipy-0.17.0-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- setuptools (target=setuptools-20.3-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- sip (target=sip-4.16.9-py35_2.tar.bz2) -> python 2.7*|3.4*|3.5*
- six (target=six-1.10.0-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- tk (target=tk-8.5.18-vc14_0.tar.bz2) -> @vc10
- tk (target=tk-8.5.18-vc14_0.tar.bz2) -> @vc14
- tk (target=tk-8.5.18-vc14_0.tar.bz2) -> @vc9
- wheel (target=wheel-0.29.0-py35_0.tar.bz2) -> python 2.7*|3.3*|3.4*|3.5*
Use "conda info <package>" to see the dependencies for each package.
Requirement already satisfied (use --upgrade to upgrade): pyshp in c:\users\i\anaconda3\lib\site-packages
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Collecting fiona
Using cached Fiona-1.7.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\i\AppData\Local\Temp\pip-build-30kz6icw\fiona\setup.py",
line 198, in <module>
copy_gdalapi_c(gdalversion)
NameError: name 'gdalversion' is not defined
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\i\AppData\Local\Temp\pip-build-30kz6icw\fiona\
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Requirement already satisfied (use --upgrade to upgrade): descartes in c:\users\i\anaconda3\lib\site-packages
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
笔记本服务器的版本是 4.1.0,运行 是 Python
3.5.1 |蟒蛇 4.0.0(32 位)| (默认,2016 年 3 月 4 日,15:28:01)[MSC v.1900 32 位(英特尔)]
我建议使用 conda-forge channel 安装那些带有 conda
的软件包。在命令行上:
conda install -c conda-forge pyshp fiona descartes
使用 pip 在 windows 上安装将不起作用(你需要正确的编译器,除非 PyPI 上提供了二进制轮,但这些包不是这种情况)
conda-forge 频道是社区主导的 conda 软件包集合。
如果您还没有安装 Anaconda,更简单的解决方案是从系统的包管理器中安装 libgdal-dev
。例如,sudo apt-get install libgdal-dev
.
我是 python 的一名相对较新的学生,仍在寻找自己的出路 大约。我通常通过堆栈溢出很快找到答案,但是 这个让我难住了
我根本无法获得用于 ipython 笔记本的形状和地图文件。 我似乎无法安装底图或 fiona
命令如下:
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.colors import Normalize
from matplotlib.collections import PatchCollection
from mpl_toolkits.basemap import Basemap
from shapely.geometry import Point, Polygon, MultiPoint, MultiPolygon
from shapely.prepared import prep
from pysal.esda.mapclassify import Natural_Breaks as nb
from descartes import PolygonPatch
import fiona
from itertools import chain
错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-120-17f76aeda5fd> in <module>()
3 from matplotlib.colors import Normalize
4 from matplotlib.collections import PatchCollection
----> 5 from mpl_toolkits.basemap import Basemap
6 from shapely.geometry import Point, Polygon, MultiPoint, MultiPolygon
7 from shapely.prepared import prep
ImportError: No module named 'mpl_toolkits.basemap'
fiona 和其他组件出现类似错误。请问我做错了什么?
我过去安装过 matplotlib 和其他组件没有问题我试过这样使用 pip 命令:
!conda install basemap
!pip install pyshp
!pip install fiona
!pip install descartes
输出:
Using Anaconda Cloud api site https://api.anaconda.org
...The following specifications were found to be in conflict:
- basemap -> matplotlib
- basemap -> numpy 1.10*|1.7*|1.8*|1.9*
- basemap -> python 2.7*
- conda -> conda-env *|<2.5|>=2.5.0
- conda -> menuinst
- conda -> pycosat
- conda -> python 2.7*
- conda -> pyyaml
- conda -> requests
- conda-env (target=conda-env-2.4.5-py35_0.tar.bz2) -> python 2.7*|3.3*|3.4*|3.5*
- cycler (target=cycler-0.10.0-py35_0.tar.bz2) -> python 2.7*|3.4*|3.5*
- cycler (target=cycler-0.10.0-py35_0.tar.bz2) -> six
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> numpy 1.10*|1.11*|1.6*|1.7*|1.8*|1.9*
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> pyqt
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> python-dateutil
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> pytz
- matplotlib (target=matplotlib-1.5.1-np110py35_0.tar.bz2) -> tk 8.5.*
- menuinst (target=menuinst-1.3.2-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- mkl-service (target=mkl-service-1.1.2-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- nose (target=nose-1.3.7-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- numexpr (target=numexpr-2.5-np110py35_0.tar.bz2) -> numpy 1.11*|1.6*
- numexpr (target=numexpr-2.5-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- numpy (target=numpy-1.10.4-py35_0.tar.bz2) -> nose
- numpy (target=numpy-1.10.4-py35_0.tar.bz2) -> python 2.7*
- pip (target=pip-8.1.1-py35_1.tar.bz2) -> python 2.7*
- pycosat (target=pycosat-0.6.1-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- pyparsing (target=pyparsing-2.0.3-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- pyqt (target=pyqt-4.11.4-py35_5.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- pyqt (target=pyqt-4.11.4-py35_5.tar.bz2) -> qt >=4.8.6|>=4.8.7
- pyqt (target=pyqt-4.11.4-py35_5.tar.bz2) -> sip >=4.16.4
- python 3.5*
- python-dateutil (target=python-dateutil-2.5.1-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- pytz (target=pytz-2016.2-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- pyyaml (target=pyyaml-3.11-py35_3.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- qt (target=qt-4.8.7-vc14_7.tar.bz2) -> @vc10
- qt (target=qt-4.8.7-vc14_7.tar.bz2) -> @vc14
- qt (target=qt-4.8.7-vc14_7.tar.bz2) -> @vc9
- requests (target=requests-2.9.1-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- scikit-learn (target=scikit-learn-0.17.1-np110py35_0.tar.bz2) -> nose
- scikit-learn (target=scikit-learn-0.17.1-np110py35_0.tar.bz2) -> numpy 1.11*|1.6*
- scikit-learn (target=scikit-learn-0.17.1-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- scikit-learn (target=scikit-learn-0.17.1-np110py35_0.tar.bz2) -> scipy
- scipy (target=scipy-0.17.0-np110py35_0.tar.bz2) -> numpy 1.11*|1.6*
- scipy (target=scipy-0.17.0-np110py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- setuptools (target=setuptools-20.3-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- sip (target=sip-4.16.9-py35_2.tar.bz2) -> python 2.7*|3.4*|3.5*
- six (target=six-1.10.0-py35_0.tar.bz2) -> python 2.6*|2.7*|3.3*|3.4*|3.5*
- tk (target=tk-8.5.18-vc14_0.tar.bz2) -> @vc10
- tk (target=tk-8.5.18-vc14_0.tar.bz2) -> @vc14
- tk (target=tk-8.5.18-vc14_0.tar.bz2) -> @vc9
- wheel (target=wheel-0.29.0-py35_0.tar.bz2) -> python 2.7*|3.3*|3.4*|3.5*
Use "conda info <package>" to see the dependencies for each package.
Requirement already satisfied (use --upgrade to upgrade): pyshp in c:\users\i\anaconda3\lib\site-packages
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Collecting fiona
Using cached Fiona-1.7.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\i\AppData\Local\Temp\pip-build-30kz6icw\fiona\setup.py",
line 198, in <module>
copy_gdalapi_c(gdalversion)
NameError: name 'gdalversion' is not defined
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\i\AppData\Local\Temp\pip-build-30kz6icw\fiona\
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Requirement already satisfied (use --upgrade to upgrade): descartes in c:\users\i\anaconda3\lib\site-packages
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
笔记本服务器的版本是 4.1.0,运行 是 Python 3.5.1 |蟒蛇 4.0.0(32 位)| (默认,2016 年 3 月 4 日,15:28:01)[MSC v.1900 32 位(英特尔)]
我建议使用 conda-forge channel 安装那些带有 conda
的软件包。在命令行上:
conda install -c conda-forge pyshp fiona descartes
使用 pip 在 windows 上安装将不起作用(你需要正确的编译器,除非 PyPI 上提供了二进制轮,但这些包不是这种情况)
conda-forge 频道是社区主导的 conda 软件包集合。
如果您还没有安装 Anaconda,更简单的解决方案是从系统的包管理器中安装 libgdal-dev
。例如,sudo apt-get install libgdal-dev
.