python - Windows 上的 Pytorch 给出 ImportError

标签 python pycharm pytorch

我按照 https://pytorch.org/ 上的说明使用 pip 安装了 Pytorch for PYthon 3.6 。

Pytorch 安装成功,但是当我运行代码时,我得到:

  File "C:\Users\\PycharmProjects\chatbot-light\pytorch\rnn_attention\seq2seq_translation_tutorial.py", line 93, in <module>
    import torch
  File "C:\Users\\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\__init__.py", line 78, in <module>
    from torch._C import *
ImportError: DLL load failed: The specified module could not be found

最佳答案

Pytorch 开发人员建议使用 Anaconda 安装 Pytorch 。

由于 Anaconda 处理所有依赖项,因此在安装 Pytorch 后不应出现任何与 DLL 相关的问题。

关于python - Windows 上的 Pytorch 给出 ImportError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50264129/

相关文章:

python - 如何对列表中的各个条目使用 split

import - 无法从pycharm中的源目录导入模块

docker - 是否有 pycharm_helpers 的存储库

pytorch - -1 在 pytorch View 中是什么意思?

python - Pytorch 中 NLLLoss 损失函数的 C 类是什么?

python - PyQt错误 “QProcess: Destroyed while process is still running”

python - 是否有与 Python 的集合类型等效的 MySQL?

python - Pytorch 索引

python - 为什么 scipy 为结果应该为零的积分提供非零结果?

Pycharm Ipython 中的 Matplotlib imshow 并不总是显示图像