最近在配置tensorflow,可是發現使用spyder的時候無法載入tensorflow的代碼提示,需要自己輸入完整的函數名稱,十分不方便,於是從網上找了一些資料,來解決spyder無法出現代碼提示的問題。
1、找到module_completion.py這個檔案,我使用的是anaconda3,路徑如下:D:\anaconda3\Lib\site-packages\spyder\utils\introspection
2、第279行可以看到這樣的代碼:
mods = ['numpy', 'scipy', 'sympy', 'pandas', 'networkx', 'statsmodels','matplotlib', 'sklearn', 'skimage', 'mpmath', 'os', 'PIL','OpenGL', 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO','cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc','imageop', 'imp', 'itertools', 'marshal', 'math', 'mmap', 'msvcrt','nt', 'operator', 'parser', 'rgbimg', 'signal', 'strop', 'sys','thread', 'time', 'wx', 'xxsubtype', 'zipimport', 'zlib', 'nose','PyQt4', 'PySide', 'os.path', 'tensorflow']
其中tensorflow是我自己加上去的,只要把你常用的模組加到這裡,在編程的時候就會自動出現函數提示
3、刪除C:\Users\Administrator\.spyder-py3\db中的submodules檔案,重啟spyder,就可以解決問題了