When I introduced Keras (tensorflow) to my Mac, I ran into various things, so I summarized it as a memorandum.
Mac OSX Mojave(10.14.6) Python3.7.3
Execute the following command in the terminal. If the version of pip is old, it will not work well, so you need to upgrade the version of pip first **
pip install --upgrade pip pip3 install --upgrade tensorflow pip3 install keras
After the above, actually launch python3 and check the operation.
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>> import keras
Using TensorFlow backend.
>>>
I was able to install it safely.
import keras
from keras.datasets import mnist
(train_images, train_labels), (test_images, test_labels) =
mnist.load_data()
It is a familiar mnist with the notation such as, but if you do mnist.load_data () with python3, the following (although it is abbreviated notation)
Exception: URL fetch failure on https://s3.amazonaws.com/img-
datasets/mnist.npz : None -- [SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: unable to get local issuer certificate
(_ssl.c:1056)
I get an error. This is the same for cifar10.load_data (). Solved by referring to here. The cause is
OpenSSL installed by default on macOS is too old, so since Python 3.6, the installer for macOS includes OpenSSL and the system's OpenSSL is no longer referenced.
And that. You can download the certifi module by executing the following code in the terminal and refer to the root certificate included in it.
cd /Applications/Python\ 3.7/Install\ Certificates.command
For deep learning in Python, I referred to the summary of here. In addition, we will update it as needed when problems occur.
Recommended Posts