Installed CUDA via Pytorch but torch.cuda.is_available() still shows false

Hi, I have a RTX4070Ti on Window 10.
I’m working on a deep learning project and because of compatibility issues with a python module I installed and uninstalled multiple versions of Pytorch.
The Pytorch version that I finally decided to use was Pytorch 2.2.1 an cuda 12.1. However, after I tried using both conda and pip to install Pytorch with Cuda 12.1, as well as installing Cuda directly via Nvidia,installer, torch.cuda.is_available() still returns False and torch.version still returns 2.0.0(even though I installed 2.2.1). But nvcc --version in cmd shows Cuda 12.3.

Could it be that I didn’t perform a clean uninstallation of the previous Pytorch versions and their residue files are causing this?