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

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
主站蜘蛛池模板: 黔江区| 沽源县| 浦县| 松江区| 临猗县| 黄大仙区| 萨迦县| 江油市| 和顺县| 乐山市| 禄劝| 十堰市| 霍林郭勒市| 温宿县| 淮滨县| 富川| 长兴县| 锦屏县| 怀来县| 东台市| 江津市| 平南县| 定陶县| 垫江县| 晋宁县| 彝良县| 开远市| 锦屏县| 班玛县| 孟连| 扎囊县| 怀集县| 衡山县| 社旗县| 五原县| 大厂| 安岳县| 安化县| 天台县| 富蕴县| 普兰县|