image 源代码

import requests
from tqdm import tqdm

url = "https://developer.download.nvidia.com/compute/cuda/12.3.2/local_installers/cuda_12.3.2_546.12_windows.exe"

#替换为你要下载的文件的URL

save_path = "C:\\Users"  # 替换为你要保存文件的路径和文件名

response = requests.get(url, stream=True)
total_size = int(response.headers.get("content-length", 0))
block_size = 1024  # 每次读取的数据块大小
progress_bar = tqdm(total=total_size, unit="B", unit_scale=True)

with open(save_path, "wb") as file:
for data in response.iter_content(block_size):
progress_bar.update(len(data))
file.write(data)

progress_bar.close()
print("文件已下载并保存到", save_path)

2 comments

  • 1