首页 > 解决方案 > 无法导入 fastai [WinError 126] 找不到指定的模块

问题描述

首先,我运行以下命令:conda install -c pytorch -c fastai fastai. 完成后install。我导入这个:

from fastai.imports import *

我有一个error这样的:

Traceback (most recent call last):

  File "C:\Users\acer\Desktop\Reddit Bot\demo.py", line 70, in <module>
    from fastai.imports import *

  File "C:\Users\acer\anaconda3\lib\site-packages\fastai\imports\__init__.py", line 2, in <module>
    from .torch import *

  File "C:\Users\acer\anaconda3\lib\site-packages\fastai\imports\torch.py", line 1, in <module>
    import torch, torch.nn.functional as F

  File "C:\Users\acer\anaconda3\lib\site-packages\torch\__init__.py", line 81, in <module>
    ctypes.CDLL(dll)

  File "C:\Users\acer\anaconda3\lib\ctypes\__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)

OSError: [WinError 126] The specified module could not be found

我看了一些帖子,stackoverflow但无法解决这个问题。我该如何解决这个问题?请帮我。

标签: pythonpython-3.xpython-2.7pytorchfast-ai

解决方案


如果您像我一样使用没有 NVIDIA GPU 卡的机器,这可能会发生。conda install -c pytorch -c fastai fastai将安装使用 GPU 的版本。

为了解决这个问题,我卸载了 pytorch,然后 conda 使用conda install pytorch torchvision cpuonly -c pytorch.它为我工作安装了 CPU 版本!可以查看官的pytorch安装指南:)


推荐阅读