Python computer visual code and python visual code
Before you begin, explain the development environment. My personal experience is that, due to version compatibility problems, learning Python often encounters Inexplicable phenomena.
Environment:
Win7 Professional Edition 64-bit Python 2.7.14Ipython 5.5.0pip 9.0.1matplotlib 2.1.0numpy 1.13.3PIL 1.1.7Pillow 4.3.0
The following code is available for test.
1 from numpy import * 2 from pylab import * 3 from PIL import Image 4 5 # Load local images, beware of Chinese characters 6 im = array (Image. open (unicode ("f: \ Desktop \ test.jpg", 'utf-8') 7 imshow (im) 8 9 10 x = [100,100,300,300] 11 y = [200,300,200,300] 12 13 # Draw points and lines on the image 14 plot (x, y, 'r *') 15 plot (x [: 2], y [: 2]) 16 17 # title and coordinate axis 18 title (unicode ("dark knight", 'utf-8 ')) 19 axis ('off') 20 21 show ()
Before making the above Code work properly, I encountered some problems and recorded the following for reference:
Q: How to check the installed python software package and Version A: pip listQ: how to install matplotlibA: python-mpip install-U matplotlib see http://matplotlib.org/users/installing.htmlQ: name array is not definedA: from numpy import * Q: When the imshow () function is used, the prompt PIL Image data can not convert to floatA: python-mpip install pillow is displayed.