1, when starting the Python script in the command line, often use the-m parameter, then-m what role?
2, first look at the information given by Python--help:
Run Library module as a script (terminates option list)
This means that the Python module in the library is used as a script to run.
3. Common examples
Python-m simplehttpserver #python2 start a simple HTTP server python-m http.server # Start a simple HTTP server in Python3
4. What is the use of the module as a script to start?
- Python xxx.py
- Python-m xxx.py
Here are two ways to load a py file:
1 is called direct run
2 equivalent to import, called as a module to start
Different ways to load the Py file are mainly affected by the Sys.path property. Sys.path equivalent to path in Linux
>>>ImportSYS>>>sys.path["','D:\\python3\\lib\\site-packages\\django-1.10.1-py3.5.egg','d:\\python3\\lIb\\site-packages\\psycopg2-2.6.2-py3.5-win32.egg', 'D:\\python3\\python35.zip', 'D:\\python3\\dlls','D:\\python3\\lib','D:\\python3','D:\\python3\\lib\\site-packages']
This is the context in which the current Python parser is running, and the Python parser will look for a dependent library in these directories.
The detailed difference can refer to this post-->http://www.cnblogs.com/xueweihan/p/5118222.html
The-m parameter of Python