100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > python pip_Python PIP

python pip_Python PIP

时间:2020-09-15 18:42:07

相关推荐

python pip_Python PIP

python pip

In this tutorial, we are going to learn about Python PIP installation and how to use pip in python. In our previous tutorial, we learned about Python Daemon Thread.

在本教程中,我们将学习Python PIP的安装以及如何在python中使用pip。 在上一教程中,我们了解了Python Daemon Thread 。

Python点 (Python pip)

Python PIP is a package manger, you can use it to install certain libraries to your python installation. You can say it is a replacement foreasy_install. We can use pip to install python modules and their dependency also.

Python PIP是一个软件包管理器,您可以使用它来将某些库安装到python安装中。 您可以说它是easy_install的替代品。 我们可以使用pip安装python模块及其依赖项。

In more simple way if we can elaborate PIP in one statement then, Pip is a package management system used to install and manage software packages written in Python. You can download PIP installation file from this link.

如果可以在一个语句中详细说明PIP,则Pip是一个软件包管理系统,用于安装和管理以Python编写的软件包。 您可以从此链接下载PIP安装文件。

问题:Python 2.x和Python 3.x:我已经有PIP吗? (Question: Python 2.x Vs Python 3.x :Do I have already PIP?)

PIP is there if you are onPython 2 >=2.7.9orPython 3 >=3.4binaries downloaded from , but you’ll need to upgrade pip. Also, pip will be there if you are working in a Virtual Environment created by virtualenv or pyvenv.

如果您使用的是从下载的Python 2> = 2.7.9Python 3> = 3.4二进制文件,则可以使用PIP,但是您需要升级pip。 另外,如果您在由virtualenv或pyvenv创建的虚拟环境中工作,pip将会存在。

Python安装点 (Python Install pip)

There are many ways to install pip, but my preferred method is the following:

有多种安装pip的方法,但我的首选方法如下:

Download the get-pip.py in your system or copy content of the above url in a text file and rename it toget-pip.py.

在系统中下载get-pip.py或将上述url的内容复制到文本文件中,并将其重命名为get-pip.py

Open a CMD window and select the folder location where the file is located. Runpython get-pip.py

For verification of a successful installation, open a CMD window and navigate to scripts folder under Python folder (Default is C:\Python27\Scripts). Type command from this location to launch the Python interpreter.

打开CMD窗口,然后选择文件所在的文件夹位置。 运行python get-pip.py

要验证安装是否成功,请打开CMD窗口并导航到Python文件夹下的scripts文件夹(默认为C:\ Python27 \ Scripts)。 从此位置键入命令以启动Python解释器。

pip freeze

pip freeze

It will show the version number of all modules installed in your Python non-standard library; on a fresh install, if there is any error it will be pop up.

它将显示您的Python非标准库中安装的所有模块的版本号; 在全新安装中,如果有任何错误,它将弹出。

Microsoft Windows [Version 6.2.9200](c) Microsoft Corporation. All rights reserved.C:\Users\Username>cd c:\Python27\Scriptsc:\Python27\Scripts>pip freezeantiorm==1.1.1enum34==1.0requests==2.3.0virtualenv==1.11.6

设置PIP的环境变量 (Set environment variable for PIP)

If you set PATH environment variable then you won’t have to reference the pip install directory again and again.

Set: (default = C:\Python27\Scripts)in your Windows/Linux “PATH” environment variable.

如果设置PATH环境变量,则不必一次又一次地引用pip安装目录。

在Windows / Linux“ PATH”环境变量中设置:(默认= C:\ Python27 \ Scripts)

其他操作系统的PIP安装 (PIP Installation for other OS)

If you’re running Linux, it’s usually already installed. For other OS follow below steps.

如果您正在运行Linux,则通常已经安装了它。 对于其他操作系统,请按照以下步骤操作。

Ubuntu:

$ sudo apt-get install python-pipUbuntu:

$ sudo apt-get install python-pipFedora:

$ sudo yum install python-pip软呢帽:

$ sudo yum install python-pipMac, you need easy_install:

$sudo easy_install pipMac,您需要easy_install:

$sudo easy_install pip

如何使用Pip和PYPI (How to use Pip and PYPI)

PYPI stands for Python Package Index. It’s required for finding a package to install. Packages will be installed from the Python Package Index. PYPI is a repository of software for the Python programming language.

PYPI代表Python软件包索引。 查找要安装的软件包是必需的。 软件包将从Python软件包索引中安装 。 PYPI是Python编程语言的软件存储库。

PIP入门 (Getting Started with PIP)

To install a package using PIP, just open up your terminal, and type in a search query using the PIP tool.

要使用PIP安装软件包,只需打开终端,然后使用PIP工具键入搜索查询。

画中画命令 (PIP Commands)

Enter pip in your terminal, it will show the following output on screen.

在终端中输入pip,它将在屏幕上显示以下输出。

Usage:pip [options]Commands:installInstall packages.uninstallUninstall packages.freeze Output installed packages in requirements format.listList installed packages.showShow information about installed packages.search Search PyPI for packages.zip Zip individual packages.unzip Unzip individual packages.bundle Create pybundles.helpShow help for commands.

Commonly used command for pip is install, upgrade or uninstall.

pip常用的命令是安装,升级或卸载。

PIP搜索包和模块 (PIP Search packages and modules)

For searching any package, i.e. Flask command will be like below.

对于搜索任何软件包,即Flask命令将如下所示。

pip search Flask

Following output will be shown with all packages and description.

以下输出将显示所有软件包和说明。

安装套件 (Installing a package)

If we want to install a required package, let’s say in our case it’s Flask. Now to install it :

如果我们要安装所需的软件包,则以Flask为例。 现在安装它:

pip install Flask

点子–显示信息 (Pip – Show information)

For checking information about our newly installed packages.

用于检查有关我们新安装的软件包的信息。

pip show Flask---Name: FlaskVersion: 0.10.1Location: /usr/local/lib/python2.7/dist-packagesRequires: Werkzeug, Jinja2, itsdangerous

卸载软件包 (Uninstalling a package)

For uninstalling any package installed by PIP, you can do as below.

要卸载由PIP安装的任何软件包,可以执行以下操作。

pip uninstall FlaskUninstalling Flask:........Proceed (y/n)?Successfully uninstalled Flask

That’s all about python pip installation and it’s usage. To know more, see their official documentation.

这就是关于python pip安装及其用法的全部内容。 要了解更多信息,请参阅其官方文档。

翻译自: /16160/python-pip

python pip

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。