【问题标题】:Can not import fastai [WinError 126] The specified module could not be foun无法导入fastai [WinError 126] 找不到指定的模块
【发布时间】:2020-08-17 13:03:49
【问题描述】:

首先我运行以下命令: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 上看了一些帖子,但无法解决这个问题。我该如何解决这个问题?请帮帮我。

【问题讨论】:

    标签: python python-3.x python-2.7 pytorch fast-ai


    【解决方案1】:

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

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

    【讨论】:

    • @HumayunAhmadRajib 真不幸!你遇到了什么错误?也许尝试创建一个全新的虚拟环境并在其中只安装 fastai 和 pytorch?否则,其他包版本可能会发生冲突并导致依赖问题。
    猜你喜欢
    • 2021-10-22
    • 1970-01-01
    • 2020-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-03
    • 2021-03-21
    相关资源
    最近更新 更多