The python that can be executed normally in the interactive environment reports an error in IDE.

1. According to Google"s official machine learning course code, there is no problem when executing in an interactive environment, but an error will be reported when executed in vscode;

the 2.python code is as follows:

import numpy as np

np.random.permutation(10)

this code outputs the following result on the line of the interactive environment:

vscode:

do any code friends know what"s going on? Ask for advice!

The ide of

python recommends that you use pycharm or sublime text,
you may have this situation because the environment is not properly configured. Generally speaking, people who engage in python are less likely to use vscode as ide


recommend using pycharm to write python code


is most likely to be that your two python/numpy are not the same version.
print np.__version__ respectively. _ version__ > 1.10 should be OK.

Menu