关于在Jupyter notebook里 同时import tensorflow和torch报错的问题

问题:在jupyter里import torch时报错

import tensorflow as tf
import torch

出现报错信息:

OSError: [WinError 182] 操作系统无法运行 %1。 Error loading "D:SoftwareAnacondaenvsDLearninglibsite-packagestorchlibshm.dll" or one of its dependencies.

单独import torch时却没有报错,在spyder里import也没有报错,十分奇怪的一个问题。

解决方法:

更改import的顺序

import torch
import tensorflow as tf

或取消import tensorflow