[Python] Jetson nano, can use cuda in python3 terminal, but not in a file

Discussão em 'Python' iniciado por Stack, Abril 2, 2025.

  1. Stack

    Stack Membro Participativo

    If I try to use cuda on the jetson nano in the terminal:

    $ python3

    > > > import torch
    > > > print(torch.cuda.is_available())
    True


    But if I start a file with the same content the output is False.

    Does anyone have any idea how to fix this?

    I've tried:

    import os
    os.environ["CUDA_VISIBLE_DEVICES"] = "0"


    and importing the file in the python terminal. While this makes cuda work, the rest of the application wont work.

    I hope to see when I start the file with python3 file.py the output True

    Continue reading...

Compartilhe esta Página