2012-09-20 13 views
12

Ich habe Probleme bei der Installation von Python-Module mit Pip. Unten ist die Ausgabe vom Befehlsfenster:Verwenden von Pip, um Module in Python zu installieren, fehlgeschlagen

Beachten Sie, dass ich pip sofort installiert habe, bevor Sie versuchen, das GDAL-Modul zu installieren.

Ich bin auf einem w7 64bit Maschine läuft Python 2,7

Microsoft Windows [Version 6.1.7601] 
Copyright (c) 2009 Microsoft Corporation. All rights reserved. 

C:\Users\jnunn\Desktop>python get-pip.py 
Downloading/unpacking pip 
Downloading pip-1.2.1.tar.gz (102Kb): 102Kb downloaded 
Running setup.py egg_info for package pip 

warning: no files found matching '*.html' under directory 'docs' 
warning: no previously-included files matching '*.txt' found under directory 
'docs\_build' 
no previously-included directories found matching 'docs\_build\_sources' 
Installing collected packages: pip 
Running setup.py install for pip 

warning: no files found matching '*.html' under directory 'docs' 
warning: no previously-included files matching '*.txt' found under directory 
'docs\_build' 
no previously-included directories found matching 'docs\_build\_sources' 
Installing pip-script.py script to C:\Python26\ArcGIS10.1\Scripts 
Installing pip.exe script to C:\Python26\ArcGIS10.1\Scripts 
Installing pip.exe.manifest script to C:\Python26\ArcGIS10.1\Scripts 
Installing pip-2.7-script.py script to C:\Python26\ArcGIS10.1\Scripts 
Installing pip-2.7.exe script to C:\Python26\ArcGIS10.1\Scripts 
Installing pip-2.7.exe.manifest script to C:\Python26\ArcGIS10.1\Scripts 
Successfully installed pip 
Cleaning up... 

C:\Users\jnunn\Desktop>pip install gdal 
Downloading/unpacking gdal 
Downloading GDAL-1.9.1.tar.gz (420kB): 420kB downloaded 
Running setup.py egg_info for package gdal 

Installing collected packages: gdal 
Running setup.py install for gdal 
building 'osgeo._gdal' extension 
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo 
/Ox /MD /W3 /GS- /DNDEBUG -I../../port -I../../gcore -I../../alg -I../../ogr/ -I 
C:\Python26\ArcGIS10.1\include -IC:\Python26\ArcGIS10.1\PC -IC:\Python26\ArcGIS1 
0.1\lib\site-packages\numpy\core\include /Tpextensions/gdal_wrap.cpp /Fobuild\te 
mp.win32-2.7\Release\extensions/gdal_wrap.obj 
gdal_wrap.cpp 
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : 
warning C4530: C++ exception handler used, but unwind semantics are not enabled 
. Specify /EHsc 
extensions/gdal_wrap.cpp(2853) : fatal error C1083: Cannot open include file 
: 'cpl_port.h': No such file or directory 
error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\c 
l.exe"' failed with exit status 2 
Complete output from command C:\Python26\ArcGIS10.1\python.exe -c "import se 
tuptools;__file__='c:\\users\\jnunn\\appdata\\local\\temp\\pip-build\\gdal\\setu 
p.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec' 
))" install --record c:\users\jnunn\appdata\local\temp\pip-f7tgze-record\install 
-record.txt --single-version-externally-managed: 
running install 

running build 

running build_py 

creating build 

creating build\lib.win32-2.7 

copying gdal.py -> build\lib.win32-2.7 

copying ogr.py -> build\lib.win32-2.7 

copying osr.py -> build\lib.win32-2.7 

copying gdalconst.py -> build\lib.win32-2.7 

copying gdalnumeric.py -> build\lib.win32-2.7 

creating build\lib.win32-2.7\osgeo 

copying osgeo\gdal.py -> build\lib.win32-2.7\osgeo 

copying osgeo\gdalconst.py -> build\lib.win32-2.7\osgeo 

copying osgeo\gdalnumeric.py -> build\lib.win32-2.7\osgeo 

copying osgeo\gdal_array.py -> build\lib.win32-2.7\osgeo 

copying osgeo\ogr.py -> build\lib.win32-2.7\osgeo 

copying osgeo\osr.py -> build\lib.win32-2.7\osgeo 

copying osgeo\__init__.py -> build\lib.win32-2.7\osgeo 

running build_ext 

building 'osgeo._gdal' extension 

creating build\temp.win32-2.7 

creating build\temp.win32-2.7\Release 

creating build\temp.win32-2.7\Release\extensions 

c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox 
/MD /W3 /GS- /DNDEBUG -I../../port -I../../gcore -I../../alg -I../../ogr/ -IC:\P 
ython26\ArcGIS10.1\include -IC:\Python26\ArcGIS10.1\PC -IC:\Python26\ArcGIS10.1\ 
lib\site-packages\numpy\core\include /Tpextensions/gdal_wrap.cpp /Fobuild\temp.w 
in32-2.7\Release\extensions/gdal_wrap.obj 

gdal_wrap.cpp 

c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : war 
ning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp 
ecify /EHsc 

extensions/gdal_wrap.cpp(2853) : fatal error C1083: Cannot open include file: 'c 
pl_port.h': No such file or directory 

error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.ex 
e"' failed with exit status 2 

---------------------------------------- 
Command C:\Python26\ArcGIS10.1\python.exe -c "import setuptools;__file__='c:\\us 
ers\\jnunn\\appdata\\local\\temp\\pip-build\\gdal\\setup.py';exec(compile(open(_ 
_file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\u 
sers\jnunn\appdata\local\temp\pip-f7tgze-record\install-record.txt --single-vers 
ion-externally-managed failed with error code 1 in c:\users\jnunn\appdata\local\ 
temp\pip-build\gdal 
Storing complete log in C:\Users\jnunn\pip\pip.log 

C:\Users\jnunn\Desktop> 

ich versucht hat, bevor zu verwenden easy_install, und es kam mit einem gemeinsamen Fehler zu dieser zurück:

c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : war 
ning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp 
ecify /EHsc 

extensions/gdal_wrap.cpp(2853) : fatal error C1083: Cannot open include file: 'c 
pl_port.h': No such file or directory 

error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.ex 
e"' failed with exit status 2 

Plus der folgende zusätzliche pip.log:

Exception information: 
Traceback (most recent call last): 
File "C:\Python26\ArcGIS10.1\lib\site-packages\pip\basecommand.py", line 107, in main 
status = self.run(options, args) 
File "C:\Python26\ArcGIS10.1\lib\site-packages\pip\commands\install.py", line 261, in run 
requirement_set.install(install_options, global_options) 
File "C:\Python26\ArcGIS10.1\lib\site-packages\pip\req.py", line 1166, in install 
requirement.install(install_options, global_options) 
File "C:\Python26\ArcGIS10.1\lib\site-packages\pip\req.py", line 589, in install 
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False) 
File "C:\Python26\ArcGIS10.1\lib\site-packages\pip\util.py", line 612, in call_subprocess 
% (command_desc, proc.returncode, cwd)) 
InstallationError: Command C:\Python26\ArcGIS10.1\python.exe -c "import setuptools;__file__='c:\\users\\jnunn\\appdata\\local\\temp\\pip-build\\gdal\\setup.py';exec(compile(open(__file__).read().replace('\r \n', '\n'), __file__, 'exec'))" install --record c:\users\jnunn\appdata\local\temp\pip-f7tgze-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\users\jnunn\appdata \local\temp\pip-build\gdal 
+2

Sie 'gdal' mit binären Installer von http://www.lfd.uci.edu/~gohlke/pythonlibs/ installieren könnte – jfs

+0

Vielleicht Forum Beitrag können Sie helfen: http://ubuntuforums.org/showthread.php?t=1769445 –

Antwort

1

Dies ist kein Python-Problem, aber ein Problem mit der Kompilierung der Quellen unter Windows.

Ich nehme an, dass Sie die installation instructions gefolgt und installiert die GDAL-Binärdateien zuerst, mit den Header-Dateien?

Darüber hinaus können Sie die Antwort auf this SO question überprüfen, die auf eine ubuntu forum zeigt, die Ihnen helfen könnte.

2

Das Problem zu installieren ist, dass Python denkt auf C installiert werden: \ Python \ aber das ist nicht wahr, wie es in portablepython ist Verzeichnis. Ich löste dies mithilfe einer Verknüpfung.

Zum Beispiel meines portablepython Verzeichnis (oder Kivy Verzeichnis in Beispiel), ist dies:

C:\Users\blabla.KMS\kivy-1.8.0-py3.3-win32\Python33 

dos eingeben Aufforderung und geben Sie:

mklink /d c:\Python33\ C:\Users\blabla.KMS\kivy-1.8.0-py3.3-win32\Python33\ 

als Sie in c gehen können: \ Python33 \ Scripts und verwenden PIP oder easy_install schließlich können Sie die Verknüpfung löschen mit:

rmdir Python33 

Cool! Ich habe Django auf kivy installiert!

+0

'mklink/dc: \ Python33 \ C: \ Benutzer \ blabla.KMS \ kivy-1.8.0-py3.3-win32 \ Python33 \' erzeugt einen Fehler für Ich: 'Kann keine Datei erstellen, wenn diese Datei bereits existiert.Wissen Sie warum? Ich benutze das folgende: 'mklink/d" C: \ Python27 \ "" C: \ Benutzer \ USR01 \ virtualenvs \ env1 \ "' als Administrator ... – jes516

+0

das kann nicht funktionieren. 1) c: \ Python33 \ ist bereits vorhanden, daher wird beim Versuch, c: \ Python33 \ mit Ihrer virtuellen Umgebung zu verknüpfen, ein Fehler ausgegeben, und umgekehrt, wenn Sie versuchen, c: \ Python33 \ mit Ihrer virtuellen Umgebung zu verknüpfen, wird eine geworfen Fehler, da die virtuelle Umgebung bereits erstellt wurde. – jes516

+0

Ich habe diese Methode verwendet, um Pakete innerhalb von portablepython und kivy zu installieren. In meinem Fall ist das Verzeichnis c: \ Python33 \ nicht vorhanden. – piertoni

0

Ich hatte das gleiche Problem, aber ich musste 'Ebooklib' Modul installieren, die nicht in der Liste der Module bei http://www.lfd.uci.edu/~gohlke/pythonlibs ist. Zur gleichen Zeit habe ich dieses Modul heruntergeladen. Aber die Installation mit ebooklib's setup.py ist fehlgeschlagen mit error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.ex e"' failed with exit status 2 Finnally, ich habe alle abhängigen Module separat installiert, von lfd.uci.edu, und danach war die Installation mit setup.py erfolgreich.

0

Ich stieß auf ein ähnliches Problem bei der Installation von Ipython ohne Anaconda. Der erste Pip konnte "cl.exe" nicht finden, wenn er pip install jupyter und nach dem Hinzufügen zu PATH, ich habe den Fehler mit dem Ausgangsstatus 2 Fehler.

Sie könnten versuchen, um mit VS-Dateien zu spielen, um es zu arbeiten, aber der einfachste Weg für mich um es zu:

1) von https://pypi.python.org/pypi 2) extrahiert in einer die tar.gz-Datei herunterladen Ordner 3) ausführen setup.py im extrahierten Ordner aus cmd:

c:\> cd <wherever your extracted folder is from .tar.gz that contains setup.py> 
c:\<yourcdhere>>python setup.py install 

Notiz wenn, wie ich, nicht wahr python in der PATH haben, weil Sie python 32b und 64b für verschiedene Dinge haben, werden Sie muss auf Python manuell zeigen (zweiten Befehl ändern in):

c:\<yourcdhere>>pythoninstallpath\python setup.py install 

und es wird automatisch die Bibliothek kopieren und installieren Sie alle seine Abhängigkeiten in Python-Installationsverzeichnis unter dem entsprechenden lib-Ordner.

Damit Sie sehen können, wie es funktioniert hat, hier ist es für mich. aber ändern Verzeichnisse zu entsprechen, was auch immer Sie verwenden:

Ich habe den extrahierten Ordner mit ipython der setup.py auf "L: \ Python \ py27_32b \ ipython-5.3.0" und Python auf dem „L installiert: \ Python \ py27_32b \ install "

c:\users\vlox>L: 
L:\>cd "python\py27_32b\ipython-5.3.0" 
L:\python\py27_32b\ipython-5.3.0>L:\python\py27_32b\install\python setup.py install 

und voila!

hoffe, das hilft

Verwandte Themen