Unresolved reference "scriptfan" less... (Ctrl+F1) This inspection detects names that should resolve but don"t. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.
PyCharm中配置python庫的匯入路徑
PyCharm 是一個非常棒的 Python IDE,它提供了完整的專案開發、除錯、版本控制、程式碼著色、自動完成等功能, 比 PyDev 好用不是一點半點。
之前朋友申請了一個 PyCharm 了的開源授權帳號,我從而有幸用到如此強大的 Python IDE,用於開發 Python 專案,非常高效。
這裡介紹一個 PyCharm 的小技巧。
對於我們透過 sys.path.insert(...) 匯入的庫,PyCharm 自然是無法識別的,編輯器會提示錯誤。
Unresolved reference "scriptfan" less... (Ctrl+F1) This inspection detects names that should resolve but don"t. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.
解決這樣的問題,可以透過更改專案的配置項來解決。
開啟 File -> Settings -> Project Settings -> Python Intercepter -> Python Intercepters 在 Paths 選項卡的列表中新增自定義的匯入路徑即可。
應用配置後,即可消除 Unresolved Reference 錯誤。