[Python] Python tenserflow.keras is not working properly

Discussão em 'Python' iniciado por Stack, Junho 21, 2025.

  1. Stack

    Stack Membro Participativo

    tensorflow.keras not resolving despite TensorFlow 2.10.0

    I'm using TensorFlow 2.10.0 and Keras 2.10.0 inside a conda environment (Python 3.10.16) on Windows, specifically because 2.10.0 is the last version with native GPU support on Windows.

    However, I'm running into this issue:

    from tensorflow.keras import layers
    # -> Import "tensorflow.keras" could not be resolved


    Even though:

    import tensorflow as tf
    print(tf.__version__) # 2.10.0

    import keras
    print(keras.__version__) # 2.10.0


    Also, running:

    python -c "from tensorflow.keras import layers; print(layers.Dense)"


    returns:

    <class 'keras.layers.core.dense.Dense'>


    ...which means it technically works, but my IDE (and sometimes runtime) still flags it as unresolved or broken.

    I’ve already tried uninstalling/reinstalling both TensorFlow and Keras, and I’m not using standalone keras anymore — only the tensorflow bundled version.

    What could be causing this inconsistency? Is it a conflict between standalone Keras and TF-bundled Keras? Any advice is appreciated

    Continue reading...

Compartilhe esta Página