<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>LHL's Blog</title><link>https://LHL66666666666.github.io/RyoLHL.github.io</link><description>基于Gmeek的个人博客</description><copyright>LHL's Blog</copyright><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><image><url>https://github.githubassets.com/favicons/favicon.svg</url><title>avatar</title><link>https://LHL66666666666.github.io/RyoLHL.github.io</link></image><lastBuildDate>Wed, 06 May 2026 13:30:20 +0000</lastBuildDate><managingEditor>LHL's Blog</managingEditor><ttl>60</ttl><webMaster>LHL's Blog</webMaster><item><title>d2l_notes</title><link>https://LHL66666666666.github.io/RyoLHL.github.io/post/d2l_notes.html</link><description>### 关于导入库的顺序问题
报错：OSError: [WinError 1114] Error loading '...\torch\lib\c10.dll' or one of its dependencies.
```python
# 这段代码能跑
import os
os.add_dll_directory(...)
import torch    # ← torch 是 add_dll_directory 之后第一个重型导入
print('成功')

# ... 后面再导入 pandas 等其他库就没事

# ==========================================

# 这段代码会报错 
import os
os.add_dll_directory(...)
import pandas as pd # ← pandas 成了第一个重型导入
import torch        # ← torch 在 pandas 之后导入，结果加载 DLL 失败
```
原因：
PyTorch 的 CUDA DLL 文件（c10.dll 及其依赖）所在的目录，不在 Windows 默认的 DLL 搜索路径中。</description><guid isPermaLink="true">https://LHL66666666666.github.io/RyoLHL.github.io/post/d2l_notes.html</guid><pubDate>Wed, 06 May 2026 13:25:23 +0000</pubDate></item></channel></rss>