When using Python, we find that it is often necessary to import some modules. Module is actually a python file, there are three kinds of modules.
one, standard module , also called standard package. This type of module is Python-brought, which can be used directly from the import. such as import String,random,datetime,os,json and so on.
second, third-party module , which is someone else to write some modules, you have to install before you can use. There are 2 methods of installation.
1, the installation of the Fool type.
For example, install the Pymysql module. Direct win key +r, open cmd, enter pip install Pymysql can.
Sometimes there are some problems, the following two kinds of problems often arise:
(1) no PIP command. Resolve it in the following ways.
A, pycharm inside dot python console
B. Find the Python installation directory
C, then put the scripts directory under the installation directory, add to the environment variable inside can
PS: Environment variables are added in path
(2) Unknown or unsupported command ' install ' out of this ask how to solve, can be resolved by the following steps.
A. Open C:\strawberry\perl\bin\
b, the list of the PIP is changed to other names, this has no effect on the other
2. Manual Installation
(1) Install WHL end of installation package
First download the installation package, open cmd in the folder where the WHL file is located, install with PIP install XXXX.WHHL
To open cmd under the specified folder, you can hold down SHIFT + right mouse button and select "Open Command Window Here"
You can also enter CMD in the Address bar of the folder, and then "enter".
(2) Install the. tar.gz end of the installation package
A, decompression of this compression package, after decompression will have a setup.py file;
b, enter the folder after decompression, open the cmd command window;
C. Enter Python setup.py install at command line
Iii. python files written by yourself
python-Module Classification and introduction