No, .keras is not the same as ~/.keras, the ~ means your $HOME folder, so
.keras is inside your home folder, not where you are running your code.
Alternatively you could just set the KERAS_BACKEND environment variable to
tensorflow and then run the python code.