I am using 1) Vi Improved 7.4 & 2) Syntastic syntax-checker for vim.
When I tried to import the "sklearn.metrics" module to use the
"pairwise_distances" functions,
from sklearn.metrics import pairwise_distances
works in both the 'python' & 'python3' terminal mode.
However, the same line caused: foo.py|8 col 1 error| [import-error] Unable to import 'sklearn.metrics'
when I put it in a .py file and opened with vim foo.py
. Yet executing the file with python3 foo.py
did not report any error.
I also tried another way to import the module by doing import sklearn.metrics as sk_met
and call sk_met.pairwise_distances(...)
in the body of my code. This works for all the aforementioned methods ('python', 'python3', 'vim foo.py'). It seem to me vim can find "sklearn.metrics" just fine, but not through from ... import
.
Could it be the syntax checker's problem?