Home > Backend Development > Python Tutorial > Share an example tutorial on installing extension packages in Python

Share an example tutorial on installing extension packages in Python

零下一度
Release: 2017-06-16 10:13:04
Original
1461 people have browsed it

This article mainly summarizes for you the installation method of expansion packages in Python. The introduction in the article is very detailed and has certain reference and learning value for everyone. Friends who need it can follow the editor to learn together.

Preface

As a pythoner, you must understand the installation of packages. This language is very similar to matlab. It is open source and shared. As long as you There are good methods, which can be used as a library for everyone to download and use. After all, as the saying goes: "Life is short, please use Python." I won't say much below, let's take a look at the detailed introduction.

The method is as follows:

1. Single file module

Copy the package to Lib in the python installation directory, eg: D:\py\Lib.

2. Multi-file module

Find the module package (compressed file zip or tar.gz) and download it, decompress it, and then execute in the console: python setup.py install xxxThat’s it

3. Use easy_install to install

Prerequisite: The easy_install tool is installed. If it is not installed: First download ez_setup.py and run python ez_setup to install the easy_install tool. [Default installation in D:\py\Scripts]

Then use the easy_install packageName/package.egg command to install

4. Use pip installation

Prerequisite: pip must be installed. If not, you can download https://pypi.python.org/pypi/pip#downloads, then unzip it, and finally enter the installation package , execute python setup.py to install [installed in D:\py\Scripts by default]

Use pip -help to view some common commands of pip

Then use

1> pip install packageName to install

2>Or use the whl file to install pip install xxx.whl Installation

Note: When downloading the whl file, it must match the current python version and system. In python In the shell, you can use

import pip

##print pip.pep425tags.get_supported() to view the whl file matching the current version

Then the downloaded whl file should be xxxxx-cp27-cp27m-win32.whl.

5. Use exe to customize the installation

Some Lei Feng on the Internet may sometimes make the package into an exe file, so under windows, you can Just click Next to install.

Note: When installing using pip or easy_install, your machine must be able to connect to the external network.

The above is the detailed content of Share an example tutorial on installing extension packages in Python. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template