2017-11-16 3 views
1

Ich versuche Keras auf Windows 10 zu installieren. Ich installierte Visual Studio 2015 Community Edition, CUDA 8.0, sein zweites Patch, CuDNN 6.0, PyCharm, Anaconda, Python 3.6.3 in diesem speziellen Auftrag. Ich installierte tensorflow-gpu. Ich habe \path-to\Python\Python36\bin zu der Umgebungsvariablen PATH und für die NVIDIA-Ordner hinzugefügt. Tensorflow funktioniert von der Shell, aber nicht von der Anaconda-Eingabeaufforderung. Wenn ich versuche, Keras mit pip install keras von PowerShell zu installieren, erhalte ich den folgenden Fehler.Kodierungsfehler bei der Installation von Keras auf Windows 10

PS C:\Users\myusr> pip install keras 
    Collecting keras 
     Downloading Keras-2.1.1-py2.py3-none-any.whl (302kB) 
     100% |████████████████████████████████| 307kB 553kB/s 
    Collecting pyyaml (from keras) 
     Downloading PyYAML-3.12.tar.gz (253kB) 
     100% |████████████████████████████████| 256kB 553kB/s 
    Collecting scipy>=0.14 (from keras) 
     Downloading scipy-1.0.0-cp36-none-win_amd64.whl (30.8MB) 
     100% |████████████████████████████████| 30.8MB 41kB/s 
    Requirement already satisfied: six>=1.9.0 in c:\users\myusr\appdata\local\programs\python\python36\lib\site-packages (from keras) 
    Requirement already satisfied: numpy>=1.9.1 in c:\users\myusr\appdata\local\programs\python\python36\lib\site-packages (from keras) 
    Building wheels for collected packages: pyyaml 
     Running setup.py bdist_wheel for pyyaml ... error 
     Failed building wheel for pyyaml 
     Running setup.py clean for pyyaml 
    Failed to build pyyaml 
    Installing collected packages: pyyaml, scipy, keras 
     Running setup.py install for pyyaml ... error 
    Exception: 
    Traceback (most recent call last): 
     File "c:\users\myusr\appdata\local\programs\python\python36\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str 
     return s.decode(sys.__stdout__.encoding) 
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8a in position 76: invalid start byte 

      During handling of the above exception, another exception occurred: 

    Traceback (most recent call last): 
     File "c:\users\myusr\appdata\local\programs\python\python36\lib\site-packages\pip\basecommand.py", line 215, in main 
     status = self.run(options, args) 
     File "c:\users\myusr\appdata\local\programs\python\python36\lib\site-packages\pip\commands\install.py", line 342, in run 
     prefix=options.prefix_path, 
     File "c:\users\myusr\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 784, in install 
     **kwargs 
     File "c:\users\myusr\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_install.py", line 878, in install 
     spinner=spinner, 
     File "c:\users\myusr\appdata\local\programs\python\python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess 
     line = console_to_str(proc.stdout.readline()) 
     File "c:\users\myusr\appdata\local\programs\python\python36\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str 
     return s.decode('utf_8') 
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8a in position 76: invalid start byte 

Was kann ich tun?

+0

Versuchen Sie, pyyaml ​​separat zu installieren und sehen Sie, ob es den gleichen Fehler gibt. $ pip install pyyaml ​​ –

+0

Versuchen Sie auch, Ihre setuptools zu aktualisieren: $ pip install --upgrade setsetools --ignore-installed –

+0

Vielen Dank. Die Fehlerausgabe ist immer noch die gleiche, es hat nicht funktioniert! – effebi

Antwort

2

Dies kommt von Pyyaml-Modul. Basierend auf der Tatsache, dass Python für Windows ab Version 3.6 UTF-8 für seine Konsolen-IO verwendet, führt es zu Fehlern. Wenn ein Subprozess ausgeführt wird, wird davon ausgegangen, dass die Ausgabe des Subprozesses ebenfalls UTF-8 ist ... was nicht der Fall ist.

Es gibt 3 Möglichkeiten, um dies zu beheben:

  1. Verwenden Python < 3.6 (zB 3.5.2)
  2. Verwenden locale.getpreferredencoding (False) für die Codierung
  3. Führen Sie einen Befehl von cmd/powershell: chcp. Es wird die System-Standard-Code zeigen, zum Beispiel 936. Öffnen Lib/site-Paket/pip/compat/init Py und um die Linie 76 Änderung

    return s.decode('utf_8') 
    

    zu

    return s.decode('cp936') 
    
+0

Englisch/Italienisch. Gibt es irgendwelche Nachteile (nicht nur in python, auch system-weise) auf die Verwendung der Option # 2? Danke, ich werde so schnell wie möglich versuchen – effebi

+0

Nicht irgendwelche, die ich über wissen würde :) Sie sind nicht Einstellung, nur bekommen. –

+0

Ich habe Methode 1 verwendet und es hat perfekt funktioniert. Vielen Dank! – effebi

Verwandte Themen