官术网_书友最值得收藏!

Installing third-party libraries

We know that we do not need to install standard modules because they come with Python, but what about third-party modules? The Python Package Index is a great place to start looking for third-party libraries. This can be found at https://pypi.org/. This service allows tools, such as pip, to install packages automatically. If an internet connection is not available or the package is not found on PyPi, a setup.py file can usually be used to install the module manually. The examples of using pip and setup.py are shown later. Tools such as pip are very convenient as they handle the installation of dependencies, check whether items are already installed, and suggest upgrades if an older version is installed. An internet connection is required to check for online resources, such as dependencies and newer versions of a module; however, pip can also be used to install code on an offline machine.

These commands are run in the Terminal or Command Prompt, not the Python interpreter. Please note that in the example mentioned below, full paths may be necessary if your Python executable is not included in the current environment's PATH variable. pip may need to be run from an elevated console, either using sudo or an elevated Windows Command Prompt. Full documentation for pip can be found at http://pip.pypa.io/en/stable/reference/pip/:

$ pip install python-registry==1.0.4
Collecting python-registry
Collecting enum34 (from python-registry)
Using cached https://files.pythonhosted.org/packages/af/42/cb9355df32c69b553e72a2e28daee25d1611d2c0d9c272aa1d34204205b2/enum34-1.1.6-py3-none-any.whl
Installing collected packages: enum34, python-registry
Successfully installed enum34-1.1.6 python-registry-1.0.4

$ pip install yarp==1.0.17
https://github.com/msuhanov/yarp/archive/1.0.17.tar.gz
Collecting https://github.com/msuhanov/yarp/archive/1.0.17.tar.gz
Downloading https://github.com/msuhanov/yarp/archive/1.0.17.tar.gz
\ 716kB 12.8MB/s
Building wheels for collected packages: yarp
Running setup.py bdist_wheel for yarp ... done
Stored in directory: C:\USERS\...\APPDATA\LOCAL\TEMP\pip-ephem-wheel-cache-78qdzfmy\wheels\........
Successfully built yarp
Installing collected packages: yarp
Successfully installed yarp-1.0.17
主站蜘蛛池模板: 和平区| 青龙| 磴口县| 安义县| 三都| 瑞昌市| 平谷区| 若羌县| 浦县| 玉树县| 东源县| 宁远县| 平阴县| 徐州市| 阆中市| 敦煌市| 靖远县| 鄯善县| 商洛市| 洮南市| 开阳县| 新和县| 定襄县| 翼城县| 措美县| 鲁甸县| 司法| 大英县| 南川市| 化德县| 吴忠市| 绥化市| 大冶市| 小金县| 白城市| 岳池县| 安顺市| 潜江市| 贺州市| 织金县| 乐清市|