今天遇到一个坑爹的问题,查找了半天原因,终于解决了,在此特地记录一下。

运行环境:Windows eclipse

我在eclipse中配置了python的运行环境,在eclipse中编写python代码。

操作步骤:

1.在python交互命令行中,输入import utils,不报错;

2.在eclipse的pydev Project中,输入import utils,报错:Unresolved import:utils

python学习笔记-import utils报错

解决方法:

1.eclipse中,点击Window-preferences-PyDev-Interpreters-Jython Interpreter,在Libraries中,点击New Folder,加入utils目录"src"的路径->点击"ok"

2.重启eclipse,即可解决

同样,可以如下解决:

1.在project右击打开菜单 ->选择properties->选择"PyDev-Interpreter/Grammar"->点击链接"Click here to configure an interpreter not listed." -> 在"Libraries"tab内,点击"new folder",加入utils的路径->点击"ok"

2.重启eclipse
 
这种方法,可以解决eclipse PyDev中,import时报错:Unresolved import

 

相关文章:

  • 2021-12-19
  • 2021-11-19
  • 2021-11-12
  • 2021-08-09
  • 2022-12-23
  • 2021-04-12
  • 2021-08-03
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2022-01-03
  • 2021-09-25
  • 2021-11-08
  • 2022-01-20
  • 2021-08-04
  • 2022-12-23
相关资源
相似解决方案