2016-06-15 7 views
3

저는 비교적 새로운 Python 학생이며, 여전히 내 길을 찾아 다니고 있습니다. . 나는 보통 스택 오버플로를 통해 대답을 꽤 빨리 발견하지만 이 하나가 나를 곤란하게한다.Basemap과 Fiona는 iPython에서지도와 shp 파일을 처리하지 못합니다. Notebook

나는 ipython 노트북에서 작동하도록 모양과 맵 파일을 얻을 수 없다. 나는베이스 맵 또는 피오나 여기

명령입니다 설치할 수없는 것 :

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' 

나는 피오나 및 기타 구성 요소에 대한 유사한 오류가 발생합니다. 나 뭐 잘못 했니?

내가 주사위를 사용 해봤 문제없이 과거에하기 matplotlib 및 기타 구성 요소를 설치 한은 그렇게 명령 :

!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 비트) | (기본값, 3 월 4 일, 1616, 15:28:01) [MSC v.1900 32 비트 (Intel)]

+0

안녕하세요, 코드의 출력 및 섹션에 대한 따옴표를 포함하여 많은 시간 형식을 사용했지만 형식 오류가 계속 발생하여 결국에는 코드로 모두 채운 다음 실행 취소하도록 수정하려고했습니다. 그러나 작동하지 않았다. – maric

+1

conda-forge 채널에서 설치할 수 있습니까? 'conda -d -c conda-forge pyshp fiona descartes' Windows에서 pip를 사용하면 작동하지 않습니다. (올바른 컴파일러가 필요합니다.) – joris

+0

안녕하세요 @joris 대단히 감사합니다. 파이썬 명령 줄에서이 것을 타이핑 하시겠습니까? 내 무지 미안해. 나는 이것에 정말로 새로운 것이다. – maric

답변

4

conda-forge channel을 사용하여 conda으로 패키지를 설치하는 것이 좋습니다.

conda install -c conda-forge pyshp fiona descartes 

(진 바퀴가 PyPI에 제공하지 않는 한, 그에 대한 올바른 컴파일러 필요하지만이 해당 패키지의 경우에는 해당되지 않습니다)

작동하지 않습니다 창문에 설치 PIP 사용 : 명령 행에서

conda-forge 채널은 커뮤니티가 주도하는 콘도 패키지 모음입니다.

+0

감사합니다. – maric

1

Anaconda를 아직 설치하지 않은 경우 간단한 솔루션은 시스템의 패키지 관리자에서 libgdal-dev을 설치하는 것입니다. 예 : sudo apt-get install libgdal-dev.