文章出處

今天遇到一個坑爹的問題,查找了半天原因,終于解決了,在此特地記錄一下。

運行環境:Windows eclipse

我在eclipse中配置了python的運行環境,在eclipse中編寫python代碼。

操作步驟:

1.在python交互命令行中,輸入import utils,不報錯;

2.在eclipse的pydev Project中,輸入import utils,報錯:Unresolved 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

 


文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()