python安装用pip安装pymysql

升级了python后发现3.6不支持mysqldb了,要用pymysql进行链接,所以用pip在window下面安装就比较方便了

一.在安装pip前,请确认win系统中已经安装好了python,

easy_install工具,如果系统安装成功,easy_install在Python安装目录下的Scripts 下面

二.进入命令行,然后把目录切换到python的安装目录下的Script文件夹下,运行 easy_inatall pip

三.pip安装成功后,在cmd下执行pip。

四.安装完成后,执行 pip install PyMySQL命令即可


cmd安装过程如下:

D:\Program Files\Python36\Scripts>easy_install.exe pip
Searching for pip
Best match: pip 9.0.1
Adding pip 9.0.1 to easy-install.pth file
Installing pip-script.py script to d:\program files\python36\Scripts
Installing pip.exe script to d:\program files\python36\Scripts
Installing pip3-script.py script to d:\program files\python36\Scripts
Installing pip3.exe script to d:\program files\python36\Scripts
Installing pip3.5-script.py script to d:\program files\python36\Scripts
Installing pip3.5.exe script to d:\program files\python36\Scripts

Using d:\program files\python36\lib\site-packages
Processing dependencies for pip
Finished processing dependencies for pip

D:\Program Files\Python36\Scripts>pip

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependen
cies.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring
                              environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be
                              used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be
                              used up to 3 times (corresponding to WARNING,
                              ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form
                              [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should
                              attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists:
                              (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
  --trusted-host <hostname>   Mark this host as trusted, even though it does
                              not have valid or any HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file
                              containing the private key and the certificate
                              in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine
                              whether a new version of pip is available for
                              download. Implied with --no-index.

D:\Program Files\Python36\Scripts>pip install PyMySQL
Collecting PyMySQL
  Downloading PyMySQL-0.8.0-py2.py3-none-any.whl (83kB)
    49% |███████████████▊                | 40kB 10kB/s eta 0:00:
    61% |███████████████████▊            | 51kB 9.4kB/s eta
    73% |███████████████████████▋        | 61kB 11kB/s e
    86% |███████████████████████████▋    | 71kB 9.9k
    98% |███████████████████████████████▌| 81kB
    100% |████████████████████████████████| 92kB
 11kB/s
Installing collected packages: PyMySQL
Successfully installed PyMySQL-0.8.0

D:\Program Files\Python36\Scripts>
好了,这样就完成pymysql的安装了,可以里链接数据库开发了。


评论/留言