Python:numpy 的 Intellisense 自动完成不正确

Python: Incorrect Intellisense autocompletion for numpy

有一件事我无法克服 - 当我在 Visual Studio 中使用 numpy 并且我想声明一个零数组时,我写道:

x = numpy.zeros(n)

这对口译员来说是正确的。但是自动完成给了我:

X = numpy.zeros_like ...

如何更改它以获得真正有用​​的自动完成功能?在 C++ 中,我一切正常,所以我猜这是 Python 情况下的内部问题。

编辑:据我所知,问题是 numpy.zeros 在 numeric.py 中定义为: zeros = multiarray.zeros。显然,这对于 IntelliSense(或 VisualAssist)来说还不够,它需要 def function 才能真正看到结构。

您需要安装python 3.5 and download the corresponding wheel for numpy. Then using the command: pip install xxxx(numpy wheel version that you download) to install it. For more the detail information about the installation staff, you can have a look at

然后在VS中打开或新建一个python应用工程,将python3.5设置为默认环境,发现numpy.zeros的智能感知在. py 文件如下图所示:(python 3.5)

如果设置python 2.7为默认环境,intellisense就像你的描述如下: