Tensorflow: Mac + Python 3.6.1: Der Versuch, mnist-Daten herunterzuladen, führt zu einem CERTIFICATE_VERIFY_FAILED-Fehler

Erstellt am 16. Juni 2017  ·  31Kommentare  ·  Quelle: tensorflow/tensorflow

System Information

  • Habe ich benutzerdefinierten Code geschrieben (im Gegensatz zu einem in TensorFlow bereitgestellten Standard-Beispielskript) : Nein
  • Betriebssystemplattform und -verteilung (z. B. Linux Ubuntu 16.04) : Mac OS X 10.12.5
  • TensorFlow installiert von (Quelle oder Binär) : Binär
  • TensorFlow-Version (verwenden Sie den Befehl unten) : v1.2.0-rc2-21-g12f033d 1.2.0
  • Bazel-Version (wenn aus der Quelle kompiliert) : n/a
  • CUDA/cuDNN-Version : keine
  • GPU-Modell und Speicher : n/a
  • Genauer Befehl zum Reproduzieren :
$ python3 --version
Python 3.6.1

$ python3 -m virtualenv venv
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.6'
New python executable in .../venv/bin/python3
Also creating executable in .../venv/bin/python
Installing setuptools, pip, wheel...done.

$ source venv/bin/activate
$ pip install tensorflow
Collecting tensorflow
  Using cached tensorflow-1.2.0-cp36-cp36m-macosx_10_11_x86_64.whl
  ....

$ python
Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorflow.examples.tutorials.mnist import input_data
>>> mnist = input_data.read_data_sets("/tmp/data/")
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
    server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket
    _context=self, _session=session)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../venv/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py", line 235, in read_data_sets
    SOURCE_URL + TRAIN_IMAGES)
  File ".../venv/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py", line 208, in maybe_download
    temp_file_name, _ = urlretrieve_with_retry(source_url)
  File ".../venv/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py", line 165, in wrapped_fn
    return fn(*args, **kwargs)
  File ".../venv/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py", line 190, in urlretrieve_with_retry
    return urllib.request.urlretrieve(url, filename)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 248, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>

Dies lässt sich mit TensorFlow 1.1 nicht reproduzieren.

awaiting response builinstall

Hilfreichster Kommentar

Dies könnte auch daran gelegen haben, dass ich vor kurzem auf eine neue Maschine umgestiegen bin und diese immer noch nur teilweise installiert ist :)

Als zukünftige Referenz: Wenn Sie das Python-dmg-Installationsprogramm verwenden möchten, müssen Sie auch die ReadMe-Datei von Python 3 lesen und das /Applications/Python 3.6/Install Certificates.command Bash-Skript ausführen, um neuere Zertifikate zu installieren.

Danke für die schnelle Antwort, @aselle!

Alle 31 Kommentare

Könnten Sie es mit Python2 versuchen (Standard-Systeminstallation von py)? Außerdem, wie haben Sie die Installation mit brew oder macports durchgeführt (wir verwenden brew für unsere Tests, damit dies wahrscheinlicher funktioniert).

Ich habe Python 3.6 mit dem dmg-Installer von der Python-Website installiert (nicht über Brew oder Macports).

Es scheint mit Python 2.7.10 zu funktionieren. Ich hatte gedacht, dass in Python 2.x urlretrieve das Serverzertifikat nicht validiert, aber anscheinend tut es das ab 2.7.9: https://docs.python.org/2/library/urllib.html

Es funktioniert bei mir unter Python 3.4 unter Linux. Ich würde versuchen, Python3.6 mit brew zu installieren. Es könnte sein, dass die von Ihnen verwendete Python3-Distribution keine Datenzertifikate hat.

Dies könnte auch daran gelegen haben, dass ich vor kurzem auf eine neue Maschine umgestiegen bin und diese immer noch nur teilweise installiert ist :)

Als zukünftige Referenz: Wenn Sie das Python-dmg-Installationsprogramm verwenden möchten, müssen Sie auch die ReadMe-Datei von Python 3 lesen und das /Applications/Python 3.6/Install Certificates.command Bash-Skript ausführen, um neuere Zertifikate zu installieren.

Danke für die schnelle Antwort, @aselle!

Wenn Sie nur Einfügen in Terminal kopieren möchten:
/Applications/Python\ 3.6/Install\ Certificates.command

Ich bekomme genau das gleiche Problem unter MacOSX 10.11.6

Ich habe zuerst genau die Schritte hier für das virtualenv Setup für Python 3.n befolgt: https://www.tensorflow.org/install/install_mac

Nach den ersten 2 Schritten in diesem Tutorial https://www.tensorflow.org/get_started/mnist/beginners sehe ich dann Folgendes; Vorschläge zur Umgehung dieses Problems (zB könnte ich das von woanders herunterladen?) wäre sehr dankbar.

(tensorflow) ~/tensorflow  $ python
Python 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorflow.examples.tutorials.mnist import input_data
>>> mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
    server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket
    _context=self, _session=session)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/aaron/tensorflow/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py", line 235, in read_data_sets
    SOURCE_URL + TRAIN_IMAGES)
  File "/Users/aaron/tensorflow/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py", line 208, in maybe_download
    temp_file_name, _ = urlretrieve_with_retry(source_url)
  File "/Users/aaron/tensorflow/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py", line 165, in wrapped_fn
    return fn(*args, **kwargs)
  File "/Users/aaron/tensorflow/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py", line 190, in urlretrieve_with_retry
    return urllib.request.urlretrieve(url, filename)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 248, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)>

@brightbytes-dude Haben Sie den hier aufgeführten Befehl ausgeführt: https://github.com/tensorflow/tensorflow/issues/10779#issuecomment -309134512

/Applications/Python\ 3.6/Install\ Certificates.command

Das hat geholfen, danke!! (Ich habe dummerweise angenommen, dass dies nur für die Installation von dmg relevant ist.)

Könnten Sie bitte die MNIST-Download-URL in contrib/learn/python/learn/datasets/mnist.py ändern, um https nicht zu verwenden? Das wird Leuten helfen, die dieses Problem haben. In einem Browser versucht und der http-Download-Link funktioniert.

Zeile zu ändern:
SOURCE_URL = ' https://storage.googleapis.com/cvdf-datasets/mnist/ '
Neue Zeile:
SOURCE_URL = ' https://storage.googleapis.com/cvdf-datasets/mnist/ '

Hallo,
Ich bin neu bei Python und Tensorflow. Versuchen Sie das MNIST-Beispiel und erhalten Sie die gleichen Fehlermeldungen wie Paulcwatt (oben)

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
Traceback (letzter Anruf zuletzt):
Datei "C:UsersAndreasDocumentsPythonliburllibrequest.py", Zeile 1318, in do_open
encode_chunked=req.has_header('Transfer-Encoding'))
Datei "C:UsersAndreasDocumentsPythonlibhttpclient.py", Zeile 1239, in Anfrage
self._send_request(Methode, URL, Text, Header, encode_chunked)
Datei "C:UsersAndreasDocumentsPythonlibhttpclient.py", Zeile 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
Datei "C:UsersAndreasDocumentsPythonlibhttpclient.py", Zeile 1234, in Endheadern
self._send_output(message_body, encode_chunked=encode_chunked)
Datei "C:UsersAndreasDocumentsPythonlibhttpclient.py", Zeile 1026, in _send_output
selbst.senden (Nachricht)
Datei "C:UsersAndreasDocumentsPythonlibhttpclient.py", Zeile 964, in send
self.connect()
Datei "C:UsersAndreasDocumentsPythonlibhttpclient.py", Zeile 1400, in connect
server_hostname=server_hostname)
Datei "C:UsersAndreasDocumentsPythonlibssl.py", Zeile 401, in wrap_socket
_context=selbst, _session=session)
Datei "C:UsersAndreasDocumentsPythonlibssl.py", Zeile 808, in __init__
self.do_handshake()
Datei "C:UsersAndreasDocumentsPythonlibssl.py", Zeile 1061, in do_handshake
self._sslobj.do_handshake()
Datei "C:UsersAndreasDocumentsPythonlibssl.py", Zeile 683, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] Zertifikatsüberprüfung fehlgeschlagen (_ssl.c:748)

Während der Behandlung der obigen Ausnahme ist eine weitere Ausnahme aufgetreten:

Traceback (letzter Anruf zuletzt):
Datei "", Zeile 1, in
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
Datei "C:UsersAndreasDocumentsPythonlibsite-packagestensorflowcontriblearnpythonlearndatasetsmnist.py", Zeile 240, in read_data_sets
source_url + TRAIN_IMAGES)
Datei "C:UsersAndreasDocumentsPythonlibsite-packagestensorflowcontriblearnpythonlearndatasetsbase.py", Zeile 208, in may_download
temp_file_name, _ = urlretrieve_with_retry(source_url)
Datei "C:UsersAndreasDocumentsPythonlibsite-packagestensorflowcontriblearnpythonlearndatasetsbase.py", Zeile 165, in Wrapped_fn
return fn( args, * kwargs)
Datei "C:UsersAndreasDocumentsPythonlibsite-packagestensorflowcontriblearnpythonlearndatasetsbase.py", Zeile 190, in urlretrieve_with_retry
return urllib.request.urlretrieve(URL, Dateiname)
Datei "C:UsersAndreasDocumentsPythonliburllibrequest.py", Zeile 248, in urlretrieve
mit contextlib.closing(urlopen(url, data)) als fp:
Datei "C:UsersAndreasDocumentsPythonliburllibrequest.py", Zeile 223, in urlopen
return opener.open(URL, Daten, Zeitüberschreitung)
Datei "C:UsersAndreasDocumentsPythonliburllibrequest.py", Zeile 526, offen
Antwort = self._open(req, data)
Datei "C:UsersAndreasDocumentsPythonliburllibrequest.py", Zeile 544, in _open
'_open', req)
Datei "C:UsersAndreasDocumentsPythonliburllibrequest.py", Zeile 504, in _call_chain
result = func(*args)
Datei "C:UsersAndreasDocumentsPythonliburllibrequest.py", Zeile 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
Datei "C:UsersAndreasDocumentsPythonliburllibrequest.py", Zeile 1320, in do_open
URLError(err) auslösen
urllib.error.URLError:

Der Hauptunterschied besteht darin, dass ich WINDOWS 10 verwende und den Befehl "Zertifikate" nicht finden kann.
Entschuldigung, dass ich vielleicht "dumme Fragen" gestellt habe, aber diese Fehler "gehen" nicht "weg".

Ich habe das gleiche Problem mit SSL und diese Zeile behebt es,
/Applications/Python 3.6/Install Certificates.command
danke @EthanAI @aselle @paulcwatts

Wenn jemand über diese Seite stolpert, aber nach der Antwort sucht, um Tensorflow Hub in Ubuntu zuzulassen, habe ich es so gemacht:

# Directory where user certs can be stored
cd /usr/local/share/ca-certificates
# Below may require elevated permissions, such as sudo su
pip3 install --upgrade certifi  # Installs a certificate file
# Move the installed cert to the place Ubuntu expects it
cp /home/ubuntu/.local/lib/python3.5/site-packages/certifi/cacert.pem .
# Convert it into the format Ubuntu expects
openssl x509 -in cacert.pem -inform pem -outform der -out cacert.crt
# Actually load the new cert into the OS
update-ca-certificates

Darüber hinaus führte eine magische Kombination aus der Konfiguration meines Unternehmens-Proxys, dem Neustart des Jupyter-Notebook-Kernels und dem Ausführen von TF Hub über ein Skript auf dem Terminal und nicht über ein Notebook dazu, dass TF Hub schließlich sowohl auf dem Terminal als auch im Notebook funktionierte .

Das Ausführen dieses Befehls ist ebenfalls fehlgeschlagen.
./Zertifikate installieren.Befehl
-- pip install --upgrade zertifikat
Zertifikate sammeln
Deserialisierung des Cache-Eintrags fehlgeschlagen, Eintrag ignoriert
URL https://pypi.python.org/simple/certifi/ konnte nicht abgerufen werden: Beim Bestätigen des SSL-Zertifikats ist ein Problem aufgetreten: [SSL: CERTIFICATE_VERIFY_FAILED] Zertifikatsüberprüfung fehlgeschlagen (_ssl.c:777) - Überspringen
Es konnte keine Version gefunden werden, die das Anforderungszertifikat erfüllt (von Versionen: )
Keine passende Distribution für Zertifikat gefunden
Traceback (letzter Anruf zuletzt):
Datei "", Zeile 44, in
Datei "", Zeile 25, in main
Datei "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", Zeile 291 in check_call
Raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Befehl '['/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6', '-E', '-s', '-m', 'pip', 'install' , '--upgrade', 'certifi']' gab den Exit-Status 1 ungleich null zurück.

unter MacOS /Applications/Python\ 3.6/Install\ Certificates.command Befehl funktioniert für mich

/Applications/Python\ 3.6/Install\ Certificates.command hat die Magie auf MacOSX High Sierra bewirkt. Danke

Was ist die Lösung für Benutzer einer virtuellen Umgebung?

Update: Es sieht so aus, als ob das Ausführen des gleichen Systembefehls, auf den oben hingewiesen wurde, auch in einem aktiven venv funktioniert. Gut zu wissen!

Wenn Sie nur Einfügen in Terminal kopieren möchten:
/Applications/Python\ 3.6/Install\ Certificates.command

Danke!

Dies könnte auch daran gelegen haben, dass ich vor kurzem auf eine neue Maschine umgestiegen bin und diese immer noch nur teilweise installiert ist :)

Als zukünftige Referenz: Wenn Sie das Python-dmg-Installationsprogramm verwenden möchten, müssen Sie auch die ReadMe-Datei von Python 3 lesen und das /Applications/Python 3.6/Install Certificates.command Bash-Skript ausführen, um neuere Zertifikate zu installieren.

Danke für die schnelle Antwort, @aselle!

Vielen Dank! Es funktionierte! :D

Vielen Dank

Könnten Sie bitte die MNIST-Download-URL in contrib/learn/python/learn/datasets/mnist.py ändern, um https nicht zu verwenden? Das wird Leuten helfen, die dieses Problem haben. In einem Browser versucht und der http-Download-Link funktioniert.

Zeile zu ändern:
SOURCE_URL = ' https://storage.googleapis.com/cvdf-datasets/mnist/ '
Neue Zeile:
SOURCE_URL = ' https://storage.googleapis.com/cvdf-datasets/mnist/ '

Ich sehe, dass beide URLs gleich sind.

Könnten Sie bitte die MNIST-Download-URL in contrib/learn/python/learn/datasets/mnist.py ändern, um https nicht zu verwenden? Das wird Leuten helfen, die dieses Problem haben. In einem Browser versucht und der http-Download-Link funktioniert.

Zeile zu ändern:
SOURCE_URL = ' https://storage.googleapis.com/cvdf-datasets/mnist/ '
Neue Zeile:
SOURCE_URL = ' https://storage.googleapis.com/cvdf-datasets/mnist/ '

Bei mir hat es funktioniert.

Wir brauchen nur Eingaben am Terminal
open "/Applications/Python 3.6/Install Certificates.command"

Könnten Sie bitte die MNIST-Download-URL in contrib/learn/python/learn/datasets/mnist.py ändern, um https nicht zu verwenden? Das wird Leuten helfen, die dieses Problem haben. In einem Browser versucht und der http-Download-Link funktioniert.
Zeile zu ändern:
SOURCE_URL = ' https://storage.googleapis.com/cvdf-datasets/mnist/ '
Neue Zeile:
SOURCE_URL = ' https://storage.googleapis.com/cvdf-datasets/mnist/ '

Ich sehe, dass beide URLs gleich sind.

' https://... ' in ' http://... ' ändern

/Applications/Python 3.7/Install Certificates.command
Arbeite für mich

Wie macht man es unter Manjaro Linux? Ich habe Python3.7-Tensorflow.

Wenn Sie nur Einfügen in Terminal kopieren möchten:
/Applications/Python\ 3.6/Install\ Certificates.command

Danke, Mann! Für mich geht das!
Ich führe einfach den Code in Jupyter Notebook aus:
!/Applications/Python\ 3.6/Install\ Certificates.command

Bei Linux...

gehe zu .local/python3.X/lib/python3.6/site-packages/keras/utils/data_utils.py

und unter Importanweisungen fügen Sie diese hinzu----

```Importanfragen
request.packages.urllib3.disable_warnings()
SSL importieren

Versuchen:
_create_unverified_https_context = ssl._create_unverified_context
außer AttributeError:
# Legacy-Python, das HTTPS-Zertifikate standardmäßig nicht überprüft
passieren
anders:
# Zielumgebung behandeln, die HTTPS-Überprüfung nicht unterstützt
ssl._create_default_https_context = _create_unverified_https_context
```

Versuchen Sie jetzt eine neue Instanz von Python und ..hoffentlich funktioniert es :smile_cat:

Dies könnte auch daran gelegen haben, dass ich vor kurzem auf eine neue Maschine umgestiegen bin und diese immer noch nur teilweise installiert ist :)

Als zukünftige Referenz: Wenn Sie das Python-dmg-Installationsprogramm verwenden möchten, müssen Sie auch die ReadMe-Datei von Python 3 lesen und das /Applications/Python 3.6/Install Certificates.command Bash-Skript ausführen, um neuere Zertifikate zu installieren.

Danke für die schnelle Antwort, @aselle!

Mit diesem Kommentar hast du mir das Leben gerettet! <3

Könnten Sie bitte die MNIST-Download-URL in contrib/learn/python/learn/datasets/mnist.py ändern, um https nicht zu verwenden? Das wird Leuten helfen, die dieses Problem haben. In einem Browser versucht und der http-Download-Link funktioniert.

Zeile zu ändern:
SOURCE_URL = ' https://storage.googleapis.com/cvdf-datasets/mnist/ '
Neue Zeile:
SOURCE_URL = ' https://storage.googleapis.com/cvdf-datasets/mnist/ '

Das funktioniert bei mir unter Ubuntu
indem Sie ~/miniconda/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/keras/datasets/mnist.py ändern

Neue Zeile
origin_folder = 'http://storage.googleapis.com/tensorflow/tf-keras-datasets/'

Folgendes hat bei mir funktioniert:

  1. Laden Sie die mnist-Datensatzdatei von Hand herunter (die URL ist in der Fehlermeldung angegeben)
  2. Kopieren Sie diese Datei nach ~/.keras/datasets/

Das ist alles. Das Dienstprogramm keras download sucht in diesem Ordner nach zwischengespeicherten Daten, bevor es über das Netzwerk geht.

(Python 3.7.3, Tensorflow 2.1.0)

/Applications/Python 3.6/Install Certificates.command funktioniert das auch für virtuelle Umgebungen?

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen