Python module mounting method

Installing Python Modules

Email  distutils-sig @ python. organization

As a popular open-source development projects, Python has an active contributor to the support and user community, and under an open source license terms, which is available to other software developers to use Python.

This enables Python users can effectively share and collaborate, others have benefited against the common (and sometimes rare!) Solution to the problem created, and it is possible to contribute their own solutions to the public repository.

The guide covers the part of the installation process. About creating and sharing your own Python program guide , refer to  issue guidelines .

note

 

For companies and other institutional users, please note that many organizations use and contribution of open source software has its own policy. When using the included Python distribution and installation tool, consider these strategies.

Key Terms

  • pipIt is the preferred installer. Starting Python 3.4, which is included by default in Python binary installer.

  • A virtual environment is a semi-isolated Python environment that allows packages to be installed by the use of a particular application, rather than being mounted system wide.

  • venvIt is to create a standard tool for virtual environments, since Python 3.3 has become part of Python. Starting Python 3.4, which is installed by defaultpip to all virtual environments created.

  • virtualenvIt is a third-party alternative (also its predecessor)  venv. It allows the use of virtual environments on Python versions prior to 3.4, these virtual environments do not providevenv , or does not automatically install pipinto the environment created.

  • In the Python Package Index is a public repository of open-source license pack for use by other Python users use provided.

  • In Python packaging Authority is the author and developer documentation of the group responsible for the maintenance and development of the standard packaging tools as well as associated metadata and file format standard. They GitHub and  Bitbucket maintenance tools, documentation, and issue tracker on .

  • distutilsIt is initially added to the Python standard library's original building and distribution system in 1998. While distutilsphasing out its direct use , but it is still current packaging and distribution infrastructure has laid a foundation, not only is part of the standard library, but can retain its name (for example, for coordination Python packaging standards development by other means the mailing list name).

Changes in version 3.5: the use of venvcurrently recommended for creating a virtual environment.

Basic Usage

All the standard packaging tools are designed to be used from the command line.

The latest version of the following command to install modules from the Python Packaging Index and its dependencies:

python -m pip install SomePackage

note

 

For POSIX users (including Mac OS X and Linux users), examples in this guide assume the use of a virtual environment .

For Windows users, examples in this guide assume that the option to adjust the system PATH environment variable is selected when installing Python.

You can also specify an exact or minimum version directly on the command line. When using the comparison operators, such as> , <or explained some of the other special characters by the shell, the package name and version should be enclosed in double quotes:

python -m pip install SomePackage==1.0.4    # specific version
python -m pip install "SomePackage>=1.0.4"  # minimum version

Generally, if the appropriate module has been installed, try to install again it will not work. You must be explicitly requested to upgrade existing modules:

python -m pip install --upgrade SomePackage

Related to pipits function more information and resources, please see " Python Package User's Guide" .

Create a virtual environment is through the module completed . Use the command shown above will install the packages into a virtual environment activity.venv

how do I…?

These are the quick answers or links to common tasks.

... is installed pipin the previous Python Python 3.4 version?

Python began pipwith Python 3.4  bundled together. For earlier versions, pip the need for "guidance" in accordance with "Python Package User's Guide" in the description.

... only for the current user to install packages?

Transfer --useroption will be only the current user to install packages, instead of installing software packages for all users of the system.python -m pip install

... installation of scientific Python packages?

Many scientific Python binary packages with complex dependencies, and is not currently easy to pipdirectly use the installation . At this time, for the user, through other ways to install these packages usually  install them than try to use easier pip .

... Can I install multiple versions of Python at the same time?

On Linux, Mac OS X and other POSIX systems, in conjunction with the version of Python commands and -mswitches to run the following command appropriate copy pip :

python2   -m pip install SomePackage  # default Python 2
python2.7 -m pip install SomePackage  # specifically Python 2.7
python3   -m pip install SomePackage  # default Python 3
python3.4 -m pip install SomePackage  # specifically Python 3.4

The appropriate version of the pipcommand may also be used.

On Windows, the pyPython and the starter -m switch combination :

py -2   -m pip install SomePackage  # default Python 2
py -2.7 -m pip install SomePackage  # specifically Python 2.7
py -3   -m pip install SomePackage  # default Python 3
py -3.4 -m pip install SomePackage  # specifically Python 3.4

Common installation problems

Python installed on your system on Linux,

On Linux systems, Python installation is usually included in the release. This installation requires root access to the system Python installation, and if accidentally upgraded component, may interfere with the operation of other components of the system and system management software packagepip .

On such systems, when used to install the package, usually best to use a virtual environment or per-user installation pip.

Not Installed

pipBy default may not be installed. One possible solution is:

python -m ensurepip --default-pip

There used to install pip of other resources .

Install the binary expansion

Python typically rely heavily on the source distribution, the end user should be compiled from the source during the expansion module is mounted.

By introducing the binary wheelformat support as well as through Python package index published at least for feature wheels Windows and Mac OS X, with the passage of time, more often as the user can install the pre-built components, it is expected to reduce the problem. Extension, without the need to build yourself.

Some  have not yet installed as pre-built documents of scientific software installed solutions wheelmay also help to obtain additional extensions binary without the need to build locally.

Guess you like

Origin www.cnblogs.com/boonya/p/11872667.html