Are you trying to create a ros package with Keras support? If so:
ROS (ROS-1) does not officially support Python 3. You can try build ROS separately with Python 3, but there’s no guarantee this would work if you need a lot of unique packages/libraries.
If you’re trying to just run an independent python script and it’s linking to python2.7, a simple test would be to run “python3 your_code.py” and see if that works. It appears as though you have multiple versions of python in your system and the default is 2.7.