1. Try running the code a second time. Juypter notebooks don't plot graphs the first time you run the code. 2. Is there a typo in your code so its not exactly the same as mine? 3. Are you sure you downloaded matplotlib and that where you are running the python code is connected to where you downloaded matplotlib too? Is it possible you are using a work computer that is blocking matplotlib because its been downloaded from an unrecognised source?
You can fit a least-squares line of best fit to data with error bars but it won't take into account the size of the error bars. If you want to take into account the size of the error bars you can use a weighted least-squares method, where data points with larger error bars will have less of an effect on the line.
In case someone ran into the problem, that the caps dont appear: just add the parameter: markeredgewidth=2 its sometimes default 0 which makes your caps disappear :)