更新时间:2023-11-25 07:54:16
在将自定义Python模块正确放置在Python目录的"Lib"文件夹下的"site-packages"文件夹中之后,Visual Studio的Intellisense会识别它们./p>
例如: /Python27/Lib/site-packages/myPython
在文件夹"myPython"内,放置一个名为"__init__.py"的纯文本文件.否则,Intellisense将无法识别您的包裹.
您可能还需要单击"Python环境"标签下的刷新数据库".
How do I add a custom python module to the Visual Studio IntelliSense code completion tool?
Situation: I am working on a python module that references another module that I have saved in /myPython/foo.py.
If I start to type foo.someDef I would like IntelliSense to recognize I am accessing that module and suggest a code completion.
Visual Studio's Intellisense will recognize custom Python modules after they have been properly placed in the "site-packages" folder under the "Lib" folder in Python's directory.
For example: /Python27/Lib/site-packages/myPython
Inside of the folder "myPython", put a plain text file called "__init__.py". Otherwise Intellisense will not recognize your package.
You may also have to click the "Refresh DB" under the Python Environments tab.