vscode中报错[pylint] E1101:Module '

2019-02-25  本文已影响0人  ryan_ren

这个错误是由于pylint为了安全起见,忽略第三方库引起的,解决方法就是将torch这个库加入到白名单中,不要对其进行检查

1.打开vscode的个人设置

2.在设置中添加以下代码

// whitelist torch to remove lint errors
    "python.linting.pylintArgs": [
        "--extension-pkg-whitelist=torch",
        "--ignored-modules=torch", 
        "--ignored-classes=torch", 
    ]

PS:

  1. 将代码中的torch改成别的库,比如numpy,也是适用的
  2. 别的人只需要添加第一个就行了,而我需要三个都加上去才有用= = 不知道什么问题
上一篇 下一篇

猜你喜欢

热点阅读