You're using the cygwin version of python, which doesn't have the matplotlib library. You need to tell cygwin that when you run the python
command, you want the windows version of Python. Add this line to your .bashrc
file.
alias python='/cygdrive/c/python27/python.exe'
If you don't know what your .bashrc
file is, just type
$ vim ~/.bashrc
and you'll be editing it. Add the above line at the bottom of the file, Then re-source it. To do this, type
$ . ~/.bashrc
The problem of running from Vim still remains: if you're using the cygwin version of vim, then it will use the cygwin path, but none of the aliases. Try this mapping to fix that (add to your ~/.vimrc
file):
au Filetype python nnoremap <leader>r :w !/cygdrive/c/python27/python.exe %<CR>
You should now be able to run the current python script with <leader>r
If you don't have a leader key, it's backslash, so the command would be \r
If you're not too committed to cygwin vim however, I would suggest getting a windows build of vim and using gVim for all your editing needs. Things like this don't get easier with time, they just get more and more complicated as you want to do more and more things.