ModuleNotFoundError: No module named 'tensorflow.examples'

I think you should use like bellow on tensorflow 2

import tensorflow_datasets
mnist = tensorflow_datasets.load('mnist')

Use the following, it will download the data. It is from the tensorflow documentation

import tensorflow as tf
(train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.mnist.load_data()

Sometimes the TensorFlow examples are not pre-downloaded, so you might need to run the below command to install the examples from Github using the below code.

!pip install -q git+https://github.com/tensorflow/examples.git

To load the mnist dataset in Tensorflow 2.0:

mnist = tf.keras.datasets.mnist

(x_train, y_train), (x_test, y_test) = mnist.load_data()

Here is the reference: TensorFlow 2 quickstart for beginners

Another method(also works for locally saved dataset):

DATA_URL = 'https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz'

path = tf.keras.utils.get_file('mnist.npz', DATA_URL)
with np.load(path) as data:
  train_examples = data['x_train']
  train_labels = data['y_train']
  test_examples = data['x_test']
  test_labels = data['y_test']

Here is the reference: Load NumPy data