如何在Windows上安装pip ?

时间:2023-01-12 20:06:55

pip is a replacement for easy_install. But should I install pip using easy_install on Windows? Is there a better way?

pip是easy_install的替代品。但是我应该在Windows上使用easy_install安装pip吗?有更好的方法吗?

35 个解决方案

#1


1608  

Python 2.7.9+ and 3.4+

Good news! Python 3.4 (released March 2014) and Python 2.7.9 (released December 2014) ship with Pip. This is the best feature of any Python release. It makes the community's wealth of libraries accessible to everyone. Newbies are no longer excluded from using community libraries by the prohibitive difficulty of setup. In shipping with a package manager, Python joins Ruby, Node.js, Haskell, Perl, Go--almost every other contemporary language with a majority open-source community. Thank you Python.

好消息!Python 3.4(发布于2014年3月)和Python 2.7.9(发布于2014年12月)与Pip一起发布。这是所有Python版本中最好的特性。它使每个人都能接触到社区丰富的图书馆。新用户不再因为设置的困难而被排除在使用社区库之外。在与包管理器一起交付时,Python加入Ruby, Node。js, Haskell, Perl, Go——几乎所有其他当代语言都是开源社区。谢谢你Python。

Of course, that doesn't mean Python packaging is problem solved. The experience remains frustrating. I discuss this in Stack Overflow question Does Python have a package/module management system?.

当然,这并不意味着Python打包解决了问题。仍令人沮丧的经验。我在Stack Overflow中讨论了这个问题:Python有一个包/模块管理系统吗?

And, alas for everyone using Python 2.7.8 or earlier (a sizable portion of the community). There's no plan to ship Pip to you. Manual instructions follow.

而且,对所有使用Python 2.7.8或更早的人(社区中相当大的一部分)来说,这是悲哀的。没有计划把Pip发给你。手动指令。

Python 2 ≤ 2.7.8 and Python 3 ≤ 3.3

Flying in the face of its 'batteries included' motto, Python ships without a package manager. To make matters worse, Pip was--until recently--ironically difficult to install.

面对“包括电池”的座右铭,“蟒蛇”(Python)飞船没有包装管理器。更糟糕的是,Pip——直到最近——具有讽刺意味地难以安装。

Official instructions

Per https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip:

每https://pip.pypa.io/en/stable/installing/ do-i-need-to-install-pip:

Download get-pip.py, being careful to save it as a .py file rather than .txt. Then, run it from the command prompt:

下载get-pip。py,小心地将它保存为.py文件而不是.txt文件。然后从命令提示符中运行:

python get-pip.py

You possibly need an administrator command prompt to do this. Follow Start a Command Prompt as an Administrator (Microsoft TechNet).

您可能需要一个管理员命令提示符来执行此操作。以管理员的身份(Microsoft TechNet)启动命令提示符。

This installs the pip package, which (in Windows) contains ...\Scripts\pip.exe that path must be in PATH environment variable to use pip from the command line (see the second part of 'Alternative Instructions' for adding it to your PATH,

安装pip包,它(在Windows中)包含…\脚本pip。exe该路径必须位于path环境变量中,才能使用命令行中的pip(参见“可选指令”的第二部分将其添加到路径中,

Alternative instructions

The official documentation tells users to install Pip and each of its dependencies from source. That's tedious for the experienced and prohibitively difficult for newbies.

官方文档告诉用户从源安装Pip及其每个依赖项。这对有经验的人来说是乏味的,对新手来说是难以接受的。

For our sake, Christoph Gohlke prepares Windows installers (.msi) for popular Python packages. He builds installers for all Python versions, both 32 and 64 bit. You need to:

为了我们的利益,Christoph Gohlke为流行的Python包准备Windows安装程序(.msi)。他为所有Python版本(32位和64位)构建安装程序。你需要:

  1. Install setuptools
  2. 安装setuptools
  3. Install pip
  4. pip安装

For me, this installed Pip at C:\Python27\Scripts\pip.exe. Find pip.exe on your computer, then add its folder (for example, C:\Python27\Scripts) to your path (Start / Edit environment variables). Now you should be able to run pip from the command line. Try installing a package:

对于我来说,这个安装了Pip在C:\Python27\脚本Pip .exe上。找到皮普。在您的计算机上,然后将它的文件夹(例如,C:\Python27\Scripts)添加到您的路径(启动/编辑环境变量)。现在您应该能够从命令行运行pip。试着安装包:

pip install httpie

There you go (hopefully)! Solutions for common problems are given below:

好了(希望)!常见问题的解决办法如下:

Proxy problems

If you work in an office, you might be behind an HTTP proxy. If so, set the environment variables http_proxy and https_proxy. Most Python applications (and other free software) respect these. Example syntax:

如果你在办公室工作,你可能是在一个HTTP代理的后面。如果是,设置环境变量http_proxy和https_proxy。大多数Python应用程序(以及其他*软件)都尊重这些。示例语法:

http://proxy_url:port
http://username:password@proxy_url:port

If you're really unlucky, your proxy might be a Microsoft NTLM proxy. Free software can't cope. The only solution is to install a free software friendly proxy that forwards to the nasty proxy. http://cntlm.sourceforge.net/

如果你真的不走运,你的代理可能是微软的NTLM代理。*软件不能应付。唯一的解决方案是安装一个免费的软件友好代理,将其转发给恶意代理。http://cntlm.sourceforge.net/

Unable to find vcvarsall.bat

Python modules can be partly written in C or C++. Pip tries to compile from source. If you don't have a C/C++ compiler installed and configured, you'll see this cryptic error message.

Python模块可以部分用C或c++编写。Pip尝试从源代码编译。如果您没有安装和配置C/ c++编译器,您将看到这个神秘的错误消息。

Error: Unable to find vcvarsall.bat

错误:无法找到vcvarsall.bat。

You can fix that by installing a C++ compiler such as MinGW or Visual C++. Microsoft actually ships one specifically for use with Python. Or try Microsoft Visual C++ Compiler for Python 2.7.

您可以通过安装c++编译器(例如MinGW或Visual c++)来解决这个问题。微软实际上专门为Python提供了一个。或者尝试为Python 2.7使用Microsoft Visual c++编译器。

Often though it's easier to check Christoph's site for your package.

通常情况下,检查Christoph网站上的软件包会更容易。

#2


289  

-- Outdated -- use distribute, not setuptools as described here. --
-- Outdated #2 -- use setuptools as distribute is deprecated.

——过时了——使用发布工具,而不是这里描述的setuptools。-- -过时的#2 -- -使用setuptools,因为发布是不推荐的。

As you mentioned pip doesn't include an independent installer, but you can install it with its predecessor easy_install.

正如您所提到的pip不包含独立的安装程序,但是您可以使用它的前身easy_install来安装它。

So:

所以:

  1. Download the last pip version from here: http://pypi.python.org/pypi/pip#downloads
  2. 从这里下载最后一个pip版本:http://pypi.python.org/pypi/pip#下载
  3. Uncompress it
  4. 解压缩它
  5. Download the last easy installer for Windows: (download the .exe at the bottom of http://pypi.python.org/pypi/setuptools ). Install it.
  6. 下载Windows的最后一个简单安装程序:(在http://pypi.python.org/pypi/setuptools的底部下载.exe)。安装它。
  7. copy the uncompressed pip folder content into C:\Python2x\ folder (don't copy the whole folder into it, just the content), because python command doesn't work outside C:\Python2x folder and then run: python setup.py install
  8. 将未压缩的pip文件夹内容复制到C:\Python2x\文件夹(不要将整个文件夹复制到其中,只复制内容),因为python命令在C:\Python2x文件夹之外不能工作,然后运行:python安装。py安装
  9. Add your python C:\Python2x\Scripts to the path
  10. 将python C:\Python2x\脚本添加到路径中

You are done.

你是做。

Now you can use pip install package to easily install packages as in Linux :)

现在,您可以使用pip安装包轻松地安装包,就像在Linux中一样:)

#3


208  

2014 UPDATE:

2014年更新:

1) If you have installed Python 3.4 or later, pip is included with Python and should already be working on your system.

1)如果您已经安装了Python 3.4或更高版本,则Python中包含pip,并且应该已经在系统上工作了。

2) If you are running a version below Python 3.4 or if pip was not installed with Python 3.4 for some reason, then you'd probably use pip's official installation script get-pip.py. The pip installer now grabs setuptools for you, and works regardless of architecture (32-bit or 64-bit).

2)如果您正在运行一个Python 3.4以下的版本,或者由于某些原因,pip没有安装到Python 3.4中,那么您可能会使用pip的官方安装脚本get-pi .py。pip安装程序现在为您获取setuptools,并且可以在任何架构(32位或64位)下工作。

The installation instructions are detailed here and involve:

这里详细介绍了安装说明,包括:

To install or upgrade pip, securely download get-pip.py.

安装或升级pip,安全下载get-pi .py。

Then run the following (which may require administrator access):

然后运行以下(可能需要管理员访问):

python get-pip.py

To upgrade an existing setuptools (or distribute), run pip install -U setuptools

要升级现有的setuptools(或分发),请运行pip install -U setuptools

I'll leave the two sets of old instructions below for posterity.

我将把这两套旧的说明留给子孙后代。

OLD Answers:

古老的答案:

For Windows editions of the 64 bit variety - 64-bit Windows + Python used to require a separate installation method due to ez_setup, but I've tested the new distribute method on 64-bit Windows running 32-bit Python and 64-bit Python, and you can now use the same method for all versions of Windows/Python 2.7X:

64位的Windows版本- 64位Windows + Python使用需要一个单独的安装方法由于ez_setup,但是我测试了新的分配方法在64位Windows Python Python运行32位和64位,现在你可以使用相同的方法对所有版本的Windows / Python 2.7 x:

OLD Method 2 using distribute:

旧方法2使用分布:

  1. Download distribute - I threw mine in C:\Python27\Scripts (feel free to create a Scripts directory if it doesn't exist.
  2. 下载发行版——我在C:\Python27\脚本(如果脚本不存在的话,请随意创建一个脚本目录。
  3. Open up a command prompt (on Windows you should check out conemu2 if you don't use PowerShell) and change (cd) to the directory you've downloaded distribute_setup.py to.
  4. 打开命令提示符(在Windows上,如果不使用PowerShell,应该检查conemu2)并将(cd)更改为已下载的distribute_setup目录。py。
  5. Run distribute_setup: python distribute_setup.py (This will not work if your python installation directory is not added to your path - go here for help)
  6. 运行distribute_setup:python distribute_setup。py(如果您的python安装目录没有添加到您的路径中,这将无法工作——请到这里寻求帮助)
  7. Change the current directory to the Scripts directory for your Python installation (C:\Python27\Scripts) or add that directory, as well as the Python base installation directory to your %PATH% environment variable.
  8. 将当前目录更改为Python安装的脚本目录(C:\Python27\Scripts),或者将该目录以及Python基础安装目录添加到您的%PATH% environment变量中。
  9. Install pip using the newly installed setuptools: easy_install pip
  10. 使用新安装的setuptools: easy_install pip安装pip

The last step will not work unless you're either in the directory easy_install.exe is located in (C:\Python27\Scripts would be the default for Python 2.7), or you have that directory added to your path.

除非您在easy_install目录中,否则最后一步将不起作用。exe位于(C:\Python27\脚本将是Python 2.7的默认),或者您将该目录添加到您的路径中。

OLD Method 1 using ez_setup:

使用ez_setup的旧方法1:

from the setuptools page --

从setuptools页面——

Download ez_setup.py and run it; it will download the appropriate .egg file and install it for you. (Currently, the provided .exe installer does not support 64-bit versions of Python for Windows, due to a distutils installer compatibility issue.

下载ez_setup。py和运行它;它将下载适当的.egg文件并为您安装它。(目前,由于distutils安装程序兼容性问题,提供的.exe安装程序不支持Windows的64位Python版本。

After this, you may continue with:

在此之后,你可以继续:

  1. Add c:\Python2x\Scripts to the Windows path (replace the x in Python2x with the actual version number you have installed)
  2. 将c:\Python2x\脚本添加到Windows路径(用你安装的实际版本号替换Python2x中的x)
  3. Open a new (!) DOS prompt. From there run easy_install pip
  4. 打开一个新的(!)DOS提示符。从那里运行easy_install pip

#4


183  

2016+ Update:

2016 +更新:

These answers are outdated or otherwise wordy and difficult.

这些答案要么过时了,要么冗长而困难。

If you've got Python 3.4+ or 2.7.9+, it will be installed by default on Windows. Otherwise, in short:

如果您有Python 3.4+或2.7.9+,它将在Windows上默认安装。否则,简而言之:

  1. Download the pip installer: https://bootstrap.pypa.io/get-pip.py
  2. 下载pip安装程序:https://bootstrap.pypa.io/get-pip.py
  3. If paranoid, inspect file to confirm it isn't malicious (must b64 decode).
  4. 如果是偏执狂,检查文件以确认它不是恶意的(必须b64解码)。
  5. Open a console in the download folder as Admin and run get-pip.py. Alternatively, right-click its icon in Explorer and choose the "run as Admin...".
  6. 在下载文件夹中打开一个控制台,作为Admin并运行get-pip.py。或者,在资源管理器中右键单击它的图标并选择“作为管理员运行…”。

The new binaries pip.exe (and the deprecated easy_install.exe) will be found in the "%ProgramFiles%\PythonXX\Scripts" folder (or similar), which is likely not in your PATH variable. I recommend adding it.

新的二进制文件皮普。exe(和已废弃的easy_install.exe)将在“%ProgramFiles%\PythonXX\Scripts”文件夹(或类似的文件夹)中找到,它可能不在您的PATH变量中。我建议添加它。

#5


42  

Python 3.4, which was released in March 2014, comes with pip included:
http://docs.python.org/3.4/whatsnew/3.4.html
So since the release of Python 3.4, the up-to-date way to install pip on Windows is to just install Python. When sticking to all defaults during installation, pip will be installed to
C:\Python34\Scripts\pip3.exe.

2014年3月发布的Python 3.4附带了pip: http://docs.python.org/3.4/whatsnew/3.4.html,所以自从Python 3.4发布以来,在Windows上安装pip的最新方法就是安装Python。当在安装过程中坚持所有默认设置时,pip将被安装到C:\Python34\脚本\pip3.exe上。

#6


37  

When I have to use Windows, I use ActivePython, which automatically adds everything to your PATH and includes a package manager called PyPM which provides binary package management making it faster and simpler to install packages.

当我必须使用Windows时,我使用ActivePython,它会自动将所有内容添加到您的路径中,并包括一个名为PyPM的包管理器,它提供二进制包管理,使安装包更快、更简单。

pip and easy_install aren't exactly the same thing, so there are some things you can get through pip but not easy_install and vice versa.

pip和easy_install并不是完全一样的东西,所以有些东西可以通过pip而不是easy_install,反之亦然。

My recommendation is that you get ActivePython Community Edition and don't worry about the huge hassle of getting everything set up for Python on Windows. Then, you can just use pypm.

我的建议是,您可以获得ActivePython社区版,并且不必担心在Windows上为Python设置所有内容的巨大麻烦。然后,你可以使用pypm。

In case you want to use pip you have to check the PyPM option in the ActiveState installer. After installation you only need to logoff and log on again, and pip will be available on the commandline, because it is contained in the ActiveState installer PyPM option and the paths have been set by the installer for you already. PyPM will also be available, but you do not have to use it.

如果您想使用pip,您必须在ActiveState安装程序中检查PyPM选项。安装之后,您只需注销并再次登录,pip将在命令行上可用,因为它包含在ActiveState installer PyPM选项中,并且安装程序已经为您设置了路径。PyPM也可以使用,但是您不必使用它。

#7


34  

The up-to-date way is to use Windows' package manager Chocolatey.

最新的方法是使用Windows的package manager Chocolatey。

Once this is installed, all you have to do is open a command prompt and run the following the three commands below, which will install Python 2.7, easy_install and pip. It will automatically detect whether you're on x64 or x86 Windows.

安装完成后,您只需打开命令提示符并运行以下三个命令,它们将安装Python 2.7、easy_install和pip。它将自动检测您是在x64还是x86 Windows上。

cinst python
cinst easy.install
cinst pip

All of the other Python packages on the Chocolatey Gallery can be found here.

巧克力画廊里所有其他的Python软件包都可以在这里找到。

#8


26  

Update March 2015

2015年3月更新

Python 2.7.9 and later (on the Python 2 series), and Python 3.4 and later include pip by default, so you may have pip already.

Python 2.7.9和后来(在Python 2系列中)和Python 3.4,之后在默认情况下包含pip,所以您可能已经有了pip。

If you don't, run this one line command on your prompt (which may require administrator access):

如果没有,请在提示符(可能需要管理员访问)上运行这一行命令:

python -c "exec('try: from urllib2 import urlopen \nexcept: from urllib.request import urlopen');f=urlopen('https://bootstrap.pypa.io/get-pip.py').read();exec(f)"

It will install pip. If Setuptools is not already installed, get-pip.py will install it for you too.

它将安装脉冲。如果Setuptools还没有安装,get-pip。py也会为您安装的。

As mentioned in comments, the above command will download code from the Pip source code repository at GitHub, and dynamically run it at your environment. So be noticed that this is a shortcut of the steps download, inspect and run, all with a single command using Python itself. If you trust Pip, proceed without doubt.

正如在注释中提到的,上面的命令将从GitHub的Pip源代码存储库中下载代码,并在您的环境中动态地运行它。因此请注意,这是使用Python本身的一个命令下载、检查和运行步骤的快捷方式。如果你信任匹普,毫无疑问地前进。

Be sure that your Windows environment variable PATH includes Python's folders (for Python 2.7.x default install: C:\Python27 and C:\Python27\Scripts, for Python 3.3x: C:\Python33 and C:\Python33\Scripts, and so on).

请确保您的Windows环境变量路径包含Python的文件夹(适用于Python 2.7)。x默认安装:C:\Python27和C:\Python27\脚本,用于Python 3.3x: \Python33和C:\Python33\脚本,等等)。

#9


24  

Installers

I've built Windows installers for both distribute and pip here (the goal being to use pip without having to either bootstrap with easy_install or save and run Python scripts):

我在这里为分布式和pip构建了Windows安装程序(目标是使用pip,而无需使用easy_install或保存和运行Python脚本):

On Windows, simply download and install first distribute, then pip from the above links. The distribute link above does contain stub .exe installers, and these are currently 32-bit only. I haven't tested the effect on 64-bit Windows.

在Windows上,只需下载并安装第一个分发版,然后从上面的链接输入pip。上面的分发链接确实包含存根.exe安装程序,这些安装程序目前只有32位。我还没有测试64位Windows的效果。

Building on Windows

The process to redo this for new versions is not difficult, and I've included it here for reference.

为新版本重做此操作的过程并不困难,我将它包含在这里以供参考。

Building distribute

In order to get the stub .exe files, you need to have a Visual C++ compiler (it is apparently compilable with MinGW as well)

为了获得存根.exe文件,您需要一个Visual c++编译器(显然,它也可以用MinGW编译)

hg clone https://bitbucket.org/tarek/distribute
cd distribute
hg checkout 0.6.27
rem optionally, comment out tag_build and tag_svn_revision in setup.cfg
msvc-build-launcher.cmd
python setup.py bdist_win32
cd ..
echo build is in distribute\dist

Building pip

git clone https://github.com/pypa/pip.git
cd pip
git checkout 1.1
python setup.py bdist_win32
cd ..
echo build is in pip\dist

#10


16  

The following works for Python 2.7. Save this script and launch it:

https://raw.github.com/pypa/pip/master/contrib/get-pip.py

Pip is installed, then add the path to your environment :

以下代码适用于Python 2.7。保存该脚本并启动:安装了https://raw.github.com/pypa/pip/master/后悔器/get- Pip .py Pip,然后将路径添加到您的环境:

C:\Python27\Scripts

Finally

最后

pip install virtualenv

Also you need Microsoft Visual C++ 2008 Express to get the good compiler and avoid these kind of messages when installing packages:

您还需要Microsoft Visual c++ 2008 Express获得好的编译器,并在安装包时避免这些消息:

error: Unable to find vcvarsall.bat

If you have a 64-bit version of Windows 7, you may read 64-bit Python installation issues on 64-bit Windows 7 to successfully install the Python executable package (issue with registry entries).

如果您有一个64位版本的Windows 7,您可以阅读64位Windows 7上的64位Python安装问题,以成功安装Python可执行包(与注册表项一起发布)。

#11


13  

To install pip globally on Python 2.x, easy_install appears to be the best solution as Adrián states.

要在Python 2上全局安装pip。正如Adrian所言,easy_install似乎是最好的解决方案。

However the installation instructions for pip recommend using virtualenv since every virtualenv has pip installed in it automatically. This does not require root access or modify your system Python installation.

但是pip的安装说明推荐使用virtualenv,因为每个virtualenv都自动安装pip。这并不需要根访问或修改系统Python安装。

Installing virtualenv still requires easy_install though.

安装virtualenv仍然需要easy_install。

2018 update:

2018年更新:

Python 3.3+ now includes the venv module for easily creating virtual environments like so:

Python 3.3+现在包含了venv模块,可以轻松创建这样的虚拟环境:

python3 -m venv /path/to/new/virtual/environment

python3 - m venv /道路/ /新/虚拟环境

See documentation for different platform methods of activating the environment after creation, but typically one of:

关于创建后激活环境的不同平台方法,请参阅文档,但通常有以下几种方法:

$ source <venv>/bin/activate 

C:\> <venv>\Scripts\activate.bat

#12


12  

To use pip, it is not mandatory that you need to install pip in the system directly. You can use it through virtualenv. What you can do is follow these steps:

要使用pip,您不需要在系统中直接安装pip。您可以通过virtualenv使用它。你所能做的就是遵循以下步骤:

  • Download virtualenv tar.gz file from https://pypi.python.org/pypi/virtualenv
  • 下载virtualenv焦油。从https://pypi.python.org/pypi/virtualenv gz文件
  • Unzip it with 7zip or some other tool
  • 用7zip或其他工具解压。

We normally need to install Python packages for one particular project. So, now create a project folder, let’s say myproject.

我们通常需要为一个特定的项目安装Python包。现在创建一个项目文件夹,比如说myproject。

  • Copy the virtualenv.py file from the decompressed folder of virtualenv, and paste inside the myproject folder
  • 复制virtualenv。从virtualenv的解压缩文件夹中提取的py文件,并粘贴到myproject文件夹中

Now create a virtual environment, let’s say myvirtualenv as follows, inside the myproject folder:

现在创建一个虚拟环境,假设myvirtualenv如下,在myproject文件夹中:

python virtualenv.py myvirtualenv

It will show you:

它将向您展示:

New python executable in myvirtualenv\Scripts\python.exe
Installing setuptools....................................done.
Installing pip.........................done.

Now your virtual environment, myvirtualenv, is created inside your project folder. You might notice, pip is now installed inside you virtual environment. All you need to do is activate the virtual environment with the following command.

现在,您的虚拟环境myvirtualenv在项目文件夹中创建。您可能会注意到,pip现在已经安装在您的虚拟环境中。您需要做的就是使用以下命令激活虚拟环境。

myvirtualenv\Scripts\activate

You will see the following at the command prompt:

您将在命令提示符中看到以下内容:

(myvirtualenv) PATH\TO\YOUR\PROJECT\FOLDER>pip install package_name

Now you can start using pip, but make sure you have activated the virtualenv looking at the left of your prompt.

现在您可以开始使用pip,但是请确保您已经激活了查看提示符左边的virtualenv。

This is one of the easiest way to install pip i.e. inside virtual environment, but you need to have virtualenv.py file with you.

这是在虚拟环境中安装pip最简单的方法之一,但是您需要使用virtualenv。py文件与你在一起时的感觉。

For more ways to install pip/virtualenv/virtualenvwrapper, you can refer to thegauraw.tumblr.com.

要了解更多安装pip/virtualenv/virtualenvwrapper的方法,可以参考thegauraw.tumblr. tumblr。

#13


11  

I just wanted to add one more solution for those having issues installing setuptools from Windows 64-bit. The issue is discussed in this bug on python.org and is still unresolved as of the date of this comment. A simple workaround is mentioned and it works flawlessly. One registry change did the trick for me.

我只是想为那些在Windows 64位中安装setuptools的问题添加一个解决方案。这个问题在python.org上的这个bug中得到了讨论,并且在这个评论的日期仍然没有解决。上面提到了一个简单的解决方案,它可以完美地工作。一次注册表更改就成功了。

Link: http://bugs.python.org/issue6792#

链接:http://bugs.python.org/issue6792

Solution that worked for me...:

对我有用的解决方案……

Add this registry setting for 2.6+ versions of Python:

为2.6+版本的Python添加注册表设置:

 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.6\InstallPath]
 @="C:\\Python26\\"

This is most likely the registry setting you will already have for Python 2.6+:

这很可能是您已经为Python 2.6+设置的注册表设置:

 [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath]
 @="C:\\Python26\\"

Clearly, you will need to replace the 2.6 version with whatever version of Python you are running.

显然,您需要用正在运行的Python版本替换2.6版本。

#14


11  

Updated at 2016 : Pip should already be included in Python 2.7.9+ or 3.4+, but if for whatever reason it is not there, you can use the following one-liner.

在2016年更新:Pip应该已经包含在Python 2.7.9+或3.4+中,但是如果出于某种原因它不存在,您可以使用以下一行代码。

  • Download https://bootstrap.pypa.io/get-pip.py and run it with Administrator permission python get-pip.py (If you are on Linux, use sudo python get-pip.py)
  • 下载:https://bootstrap.pypa.io/get-pip。py和运行它的管理员权限python get-pip。py(如果您在Linux上,请使用sudo python get-pi .py)

PS:

PS:

  1. This should already be satisfied in most cases but, if necessary, be sure that your environment variable PATH includes Python's folders (for example, Python 2.7.x on Windows default install: C:\Python27 and C:\Python27\Scripts, for Python 3.3x: C:\Python33 and C:\Python33\Scripts, etc)

    这在大多数情况下应该已经得到满足,但是如果需要,请确保您的环境变量路径包含Python的文件夹(例如,Python 2.7)。C:\Python27和C:\Python27\脚本,适用于Python 3.3x: C:\Python33和C:\Python33\脚本,等等)

  2. I encounter same problem and then found such perhaps easiest way (one liner!) mentioned on official website here: http://www.pip-installer.org/en/latest/installing.html

    我遇到了同样的问题,然后在官方网站上找到了这样可能最简单的方法:http://www.pip-installer.org/en/latest/installing.html。

Can't believe there are so many lengthy (perhaps outdated?) answers out there. Feeling thankful to them but, please up-vote this short answer to help more new comers!

真不敢相信有这么多冗长(也许已经过时了?)的答案。感谢他们,但是,请投票支持这个简短的回答,以帮助更多的新来者!

#15


10  

The best way I found so far, is just two lines of code:

到目前为止,我发现的最好的方法,就是两行代码:

curl http://python-distribute.org/distribute_setup.py | python
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

It was tested on Windows 8 with PowerShell, Cmd, and Git Bash (MinGW).

它在Windows 8上使用PowerShell、Cmd和Git Bash (MinGW)进行测试。

And you probably want to add the path to your environment. It's somewhere like C:\Python33\Scripts.

您可能想要添加路径到您的环境。某个地方像C:\ Python33 \脚本。

#16


9  

PythonXY comes with pip included, among others.

PythonXY和pip包括在内。

#17


9  

Here how to install pip with easy way.

这里介绍了如何用简单的方法安装pip。

  1. copy and paste these content in a file as get-pip.py
  2. 将这些内容复制粘贴到一个文件中作为get-pi .py
  3. copy and paste get-pip.py into python folder.C:\Python27
  4. 复制和粘贴get-pip。py到python folder.C:\ Python27
  5. Double click to get-pip.py file.it will install pip to your computer.
  6. 双击get-pip。py文件。它会在你的电脑上安装pip。
  7. Now you have to add C:\Python27\Scripts path to your enviroment variable.Because it includes pip.exe file.
  8. 现在您必须添加C:\Python27\脚本路径到您的环境变量。因为它包含了皮普。exe文件。
  9. Now you are ready to use pip. Open cmd and type as
    pip install package_name
  10. 现在可以使用pip了。打开cmd并输入pip安装package_name

#18


8  

I use the cross-platform Anaconda package manager from continuum.io on Windows and it is reliable. It has virtual environment management and a fully featured shell with common utilities (e.g. conda, pip).

我使用了来自continuum的跨平台的Anaconda包管理器。操作简单,操作可靠。它具有虚拟环境管理和功能齐全的shell,具有公共实用程序(例如conda、pip)。

> conda install <package>               # access distributed binaries

> pip install <package>                 # access PyPI packages 

conda also comes with binaries for libraries with non-Python dependencies, e.g. pandas, numpy, etc. This proves useful particularly on Windows as it can be hard to correctly compile C dependencies.

conda还为具有非python依赖项的库提供了二进制文件,例如panda、numpy等。这在Windows上尤其有用,因为很难正确编译C依赖项。

#19


8  

For latest Python Download - I have python 3.6 on windows. You don't have to wonder everything you need is there , take a breath i will show you how to do it.

对于最新的Python下载——我在windows上有Python 3.6。你不必去想你需要的一切都在那里,深呼吸,我来告诉你怎么做。

  1. make sure where you install python for me its was in the following directory 如何在Windows上安装pip ?
  2. 请确保您为我安装了python,它在以下目录中

Now , lets add python and pip into environment variable path settings if you are on windows, so that typing pip or python anywhere call python aor pip from where they are installed.

现在,如果您在windows上,那么让我们将python和pip添加到环境变量路径设置中,这样输入pip或python anywhere就可以从它们安装的位置调用python aor pip。

So, PIP is found under the folder in above screen "SCRIPTS" Lets add Python and PIP in environment variable path. 如何在Windows上安装pip ?

因此,PIP是在屏幕上的“脚本”文件夹下找到的,允许在环境变量路径中添加Python和PIP。

Almost Done , Let test with CMD to install goole package using pip.

差不多完成了,让CMD测试用pip安装goole包。

pip install google

如何在Windows上安装pip ?

BYE BYE!

再见再见!

#20


6  

I wrote this pip install script that wraps both the ez_setup.py and get-pip.py install scripts that were mentioned in Gringo Suave's answer (and runs a pip install --upgrade setuptools for the latest setuptools version once pip is installed).

我编写了这个pip安装脚本,它封装了两个ez_setup。py和get-pip。py安装脚本在Gringo Suave的答案中被提及(并运行一个pip安装——升级setuptools,用于安装pip之后的最新setuptools版本)。

Clone the repository with:

克隆存储库:

git clone https://github.com/chrissimpkins/pip-installer.git

Or download a .zip archive:

或下载。zip档案:

https://github.com/chrissimpkins/pip-installer/archive/master.zip

https://github.com/chrissimpkins/pip-installer/archive/master.zip

And then run the pipinstall.py script in the top level of the repository directory:

然后运行pipinstall。存储库目录顶层的py脚本:

python pipinstall.py

This will give you the latest releases for both applications. It's safe to remove the script repository after the install.

这将为您提供这两个应用程序的最新版本。在安装之后删除脚本存储库是安全的。

#21


6  

I had some issues installing in different ways when I followed instructions here. I think it's very tricky to install in every Windows environment in the same way. In my case I need Python 2.6, 2.7 and 3.3 in the same machine for different purposes so that's why I think there're more problems. But the following instructions worked perfectly for me, so might be depending on your environment you should try this one:

当我按照这里的说明安装时,我有一些不同的问题。我认为以同样的方式在每个Windows环境中安装是非常棘手的。在我的例子中,为了不同的目的,我需要在同一台机器中使用Python 2.6、2.7和3.3,所以我认为还有更多的问题。但是以下的指导对我来说非常有效,所以你应该根据你的环境来尝试一下:

http://docs.python-guide.org/en/latest/starting/install/win/

http://docs.python-guide.org/en/latest/starting/install/win/

Also, due to the different environments I found incredible useful to use Virtual Environments, I had websites that use different libraries and it's much better to encapsulate them into a single folder, check out the instructions, briefly if PIP is installed you just install VirtualEnv:

此外,由于使用虚拟环境的环境不同,我发现使用虚拟环境非常有用,我有使用不同库的网站,最好将它们封装到一个文件夹中,查看说明,简单地说,如果安装了PIP,您只需安装VirtualEnv:

pip install virtualenv

Into the folder you have all your files run

将所有文件运行到文件夹中

virtualenv venv

And seconds later you have a virtual environment with everything in venv folder, to activate it run venv/Scripts/activate.bat (deactivate the environment is easy, use deactivate.bat). Every library you install will end up in venv\Lib\site-packages and it's easy to move your whole environment somewhere.

几秒钟后,您就拥有了一个虚拟环境,其中包含venv文件夹中的所有内容,以激活它运行venv/Scripts/activate。bat(关闭环境很容易,使用deactivator .bat)。你安装的每一个库都将以venv\Lib\site-packages结尾,并且很容易将整个环境移动到某个地方。

The only downside I found is some code editors can't recognize this kind of environments, and you will see warnings in your code because imported libraries are not found. Of course there're tricky ways to do it but it would be nice editors keep in mind Virtual Environments are very normal nowadays.

我发现的唯一缺点是有些代码编辑器不能识别这种环境,您将在代码中看到警告,因为没有找到导入的库。当然,有一些巧妙的方法可以做到这一点,但要让编辑们记住虚拟环境是很正常的。

Hope it helps.

希望它可以帮助。

#22


6  

  1. Download script: https://raw.github.com/pypa/pip/master/contrib/get-pip.py
  2. 下载脚本:https://raw.github.com/pypa/pip/master/contrib/get-pip.py
  3. Save it on drive somewhere like C:\pip-script\get-pip.py
  4. 把它保存在C:\pip-script\get-pi .py这样的驱动器上
  5. Navigate to that path from command prompt and run " python get-pip.py "
  6. 从命令提示符导航到该路径并运行“python get-pip”。py”

Guide link: http://www.pip-installer.org/en/latest/installing.html#install-pip

指南链接:http://www.pip-installer.org/en/latest/installing.html install-pip

Note: Make sure scripts path like this (C:\Python27\Scripts) is added int %PATH% environment variable as well.

注意:确保像这样的脚本路径(C:\Python27\脚本)也添加了int % path %环境变量。

#23


3  

It's very simple:

这是非常简单的:

Step 1: wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
Step 2: wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
Step 2: python ez_setup.py
Step 3: python get-pip.py

(Make sure your Python and Python script directory (for example, C:\Python27 and C:\Python27\Scripts) are in the PATH.)

(确保您的Python和Python脚本目录(例如,C:\Python27和C:\Python27\Scripts)在路径中)。

#24


3  

Working as of Feb 04 2014 :):

2014年2月04日工作:

If you have tried installing pip through the Windows installer file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip as suggested by @Colonel Panic, you might have installed the pip package manager successfully, but you might be unable to install any packages with pip. You might also have got the same SSL error as I got when I tried to install Beautiful Soup 4 if you look in the pip.log file:

如果您尝试通过http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip的Windows安装文件安装pip,就像@Colonel Panic建议的那样,您可能已经成功安装了pip包管理器,但是您可能无法使用pip安装任何包。如果查看pip,您可能也会得到与我尝试安装漂亮的Soup 4时相同的SSL错误。日志文件:

Downloading/unpacking beautifulsoup4
  Getting page https://pypi.python.org/simple/beautifulsoup4/
  Could not fetch URL https://pypi.python.org/simple/beautifulsoup4/: **connection error: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed**
  Will skip URL https://pypi.python.org/simple/beautifulsoup4/ when looking for download links for beautifulsoup4

The problem is an issue with an old version of OpenSSL being incompatible with pip 1.3.1 and above versions. The easy workaround for now, is to install pip 1.2.1, which does not require SSL:

问题是旧版本的OpenSSL与pip 1.3.1及以上版本不兼容。目前最简单的解决方案是安装pip 1.2.1,它不需要SSL:

Installing Pip on Windows:

皮普在Windows上安装:

  1. Download pip 1.2.1 from https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz
  2. 从https://pypi.python.org/packages/source/p/pip/pip- 1.2.1.1.tar.gz下载pip 1.2.1
  3. Extract the pip-1.2.1.tar.gz file
  4. 提取pip-1.2.1.tar。gz文件
  5. Change directory to the extracted folder: cd <path to extracted folder>/pip-1.2.1
  6. 将目录更改为提取文件夹:cd <到提取文件夹> /pip-1.2.1的路径
  7. Run python setup.py install
  8. python运行设置。py安装
  9. Now make sure C:\Python27\Scripts is in PATH because pip is installed in the C:\Python27\Scripts directory unlike C:\Python27\Lib\site-packages where Python packages are normally installed
  10. 现在请确保C:\Python27\脚本在路径中,因为pip安装在C:\Python27\Scripts目录中,不像C:\Python27\Lib\ Lib\site-packages, Python包通常安装在C:\Python27\Scripts目录中

Now try to install any package using pip.

现在尝试使用pip安装任何包。

For example, to install the requests package using pip, run this from cmd:

例如,要使用pip安装请求包,请运行cmd:

pip install requests

Whola! requests will be successfully installed and you will get a success message.

Whola !请求将成功安装,您将获得一条成功消息。

#25


3  

pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4 binaries downloaded from python.org, but you'll need to upgrade pip.

如果您正在使用Python 2 >=2.7.9或Python 3 >=3.4从python.org下载的二进制文件,则已经安装了pip,但是您需要升级pip。

On Windows upgrade can be done easily

在Windows上升级很容易

Go to Python command line and run below Python command

转到Python命令行并在Python命令下运行

python -m pip install -U pip

python -m pip安装-U pip。

Installing with get-pip.py

安装与get-pip.py

Download get-pip.py in the same folder or any other folder of your choice. I am assuming you will download it in the same folder from you have python.exe file and run this command

下载get-pip。在同一文件夹或您选择的任何其他文件夹中的py。我假设您将在您拥有python的同一文件夹中下载它。执行exe文件并运行此命令

python get-pip.py

Pip's installation guide is pretty clean and simple.

Pip的安装指南非常简洁。

Using this you should be able to get started with Pip in under two minutes.

使用这个工具,您应该能够在两分钟内开始使用Pip。

#26


2  

Just download setuptools-15.2.zip (md5), from here https://pypi.python.org/pypi/setuptools#windows-simplified , and run ez_setup.py.

只是下载setuptools - 15.2。zip (md5),从这里开始,https://pypi.python.org/pypi/setuptools# windowssimplified,运行ez_setup.py。

#27


2  

Alternatively, you can get pip-Win which is an all-in-one installer for pip and virtualenv on Windows and its GUI.

另外,您还可以获得pip- win,它是pip和virtualenv在Windows和它的GUI上的一体式安装程序。

  • Switch from one Python interpreter (i.e. version) to another (including py and pypy)
  • 从一个Python解释器(即版本)切换到另一个(包括py和pypy)
  • See all installed packages, and whether they are up-to-date
  • 查看所有已安装的包,以及它们是否最新
  • Install or upgrade a package, or upgrade pip itself
  • 安装或升级包,或升级pip本身。
  • Create and delete virtual environments, and switch between them
  • 创建和删除虚拟环境,并在它们之间进行切换
  • Run the IDLE or another Python script, with the selected interpreter
  • 使用所选的解释器运行空闲或另一个Python脚本

#28


2  

you have to get the get_pip.py file search it on google copy from there and save it locally in c drive in pip directory

您必须获得get_pip。py文件从那里在谷歌拷贝上搜索它,并将它本地保存在pip目录的c驱动器中

#29


2  

Sometime it easier to understand when you use IDE:

有时使用IDE更容易理解:

  • Install PyCharm
  • 安装PyCharm
  • And create virtual environment it will automatically install pip
  • 并创建虚拟环境,自动安装pip
  • Then in code you could install any python packages 如何在Windows上安装pip ?
  • 然后在代码中可以安装任何python包

#30


1  

I think the question makes it seem like the answer is simpler than it really is. Running of pip will sometimes require native compilation of a module (64-bit Numpy is a common example of that). In order for pip's compilation to succeed, you need Python which was compiled with the same version of MSVC as the one pip is using. Standard Python distributions are compiled with MSVC 2008. You can install an Express version of VC2008, but it is not maintained. Your best bet is to get an express version of a later MSVC and compile Python. Then PIP and Python will be using the same MSVC version.

我认为这个问题让人觉得答案比实际要简单。pip的运行有时需要对模块进行本机编译(64位Numpy是一个常见的例子)。为了使pip编译成功,您需要使用与pip使用的MSVC版本相同的Python。标准的Python发行版是使用MSVC 2008编译的。您可以安装VC2008的一个快速版本,但是没有维护它。最好的办法是获得一个新的MSVC的快速版本并编译Python。然后PIP和Python将使用相同的MSVC版本。

#1


1608  

Python 2.7.9+ and 3.4+

Good news! Python 3.4 (released March 2014) and Python 2.7.9 (released December 2014) ship with Pip. This is the best feature of any Python release. It makes the community's wealth of libraries accessible to everyone. Newbies are no longer excluded from using community libraries by the prohibitive difficulty of setup. In shipping with a package manager, Python joins Ruby, Node.js, Haskell, Perl, Go--almost every other contemporary language with a majority open-source community. Thank you Python.

好消息!Python 3.4(发布于2014年3月)和Python 2.7.9(发布于2014年12月)与Pip一起发布。这是所有Python版本中最好的特性。它使每个人都能接触到社区丰富的图书馆。新用户不再因为设置的困难而被排除在使用社区库之外。在与包管理器一起交付时,Python加入Ruby, Node。js, Haskell, Perl, Go——几乎所有其他当代语言都是开源社区。谢谢你Python。

Of course, that doesn't mean Python packaging is problem solved. The experience remains frustrating. I discuss this in Stack Overflow question Does Python have a package/module management system?.

当然,这并不意味着Python打包解决了问题。仍令人沮丧的经验。我在Stack Overflow中讨论了这个问题:Python有一个包/模块管理系统吗?

And, alas for everyone using Python 2.7.8 or earlier (a sizable portion of the community). There's no plan to ship Pip to you. Manual instructions follow.

而且,对所有使用Python 2.7.8或更早的人(社区中相当大的一部分)来说,这是悲哀的。没有计划把Pip发给你。手动指令。

Python 2 ≤ 2.7.8 and Python 3 ≤ 3.3

Flying in the face of its 'batteries included' motto, Python ships without a package manager. To make matters worse, Pip was--until recently--ironically difficult to install.

面对“包括电池”的座右铭,“蟒蛇”(Python)飞船没有包装管理器。更糟糕的是,Pip——直到最近——具有讽刺意味地难以安装。

Official instructions

Per https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip:

每https://pip.pypa.io/en/stable/installing/ do-i-need-to-install-pip:

Download get-pip.py, being careful to save it as a .py file rather than .txt. Then, run it from the command prompt:

下载get-pip。py,小心地将它保存为.py文件而不是.txt文件。然后从命令提示符中运行:

python get-pip.py

You possibly need an administrator command prompt to do this. Follow Start a Command Prompt as an Administrator (Microsoft TechNet).

您可能需要一个管理员命令提示符来执行此操作。以管理员的身份(Microsoft TechNet)启动命令提示符。

This installs the pip package, which (in Windows) contains ...\Scripts\pip.exe that path must be in PATH environment variable to use pip from the command line (see the second part of 'Alternative Instructions' for adding it to your PATH,

安装pip包,它(在Windows中)包含…\脚本pip。exe该路径必须位于path环境变量中,才能使用命令行中的pip(参见“可选指令”的第二部分将其添加到路径中,

Alternative instructions

The official documentation tells users to install Pip and each of its dependencies from source. That's tedious for the experienced and prohibitively difficult for newbies.

官方文档告诉用户从源安装Pip及其每个依赖项。这对有经验的人来说是乏味的,对新手来说是难以接受的。

For our sake, Christoph Gohlke prepares Windows installers (.msi) for popular Python packages. He builds installers for all Python versions, both 32 and 64 bit. You need to:

为了我们的利益,Christoph Gohlke为流行的Python包准备Windows安装程序(.msi)。他为所有Python版本(32位和64位)构建安装程序。你需要:

  1. Install setuptools
  2. 安装setuptools
  3. Install pip
  4. pip安装

For me, this installed Pip at C:\Python27\Scripts\pip.exe. Find pip.exe on your computer, then add its folder (for example, C:\Python27\Scripts) to your path (Start / Edit environment variables). Now you should be able to run pip from the command line. Try installing a package:

对于我来说,这个安装了Pip在C:\Python27\脚本Pip .exe上。找到皮普。在您的计算机上,然后将它的文件夹(例如,C:\Python27\Scripts)添加到您的路径(启动/编辑环境变量)。现在您应该能够从命令行运行pip。试着安装包:

pip install httpie

There you go (hopefully)! Solutions for common problems are given below:

好了(希望)!常见问题的解决办法如下:

Proxy problems

If you work in an office, you might be behind an HTTP proxy. If so, set the environment variables http_proxy and https_proxy. Most Python applications (and other free software) respect these. Example syntax:

如果你在办公室工作,你可能是在一个HTTP代理的后面。如果是,设置环境变量http_proxy和https_proxy。大多数Python应用程序(以及其他*软件)都尊重这些。示例语法:

http://proxy_url:port
http://username:password@proxy_url:port

If you're really unlucky, your proxy might be a Microsoft NTLM proxy. Free software can't cope. The only solution is to install a free software friendly proxy that forwards to the nasty proxy. http://cntlm.sourceforge.net/

如果你真的不走运,你的代理可能是微软的NTLM代理。*软件不能应付。唯一的解决方案是安装一个免费的软件友好代理,将其转发给恶意代理。http://cntlm.sourceforge.net/

Unable to find vcvarsall.bat

Python modules can be partly written in C or C++. Pip tries to compile from source. If you don't have a C/C++ compiler installed and configured, you'll see this cryptic error message.

Python模块可以部分用C或c++编写。Pip尝试从源代码编译。如果您没有安装和配置C/ c++编译器,您将看到这个神秘的错误消息。

Error: Unable to find vcvarsall.bat

错误:无法找到vcvarsall.bat。

You can fix that by installing a C++ compiler such as MinGW or Visual C++. Microsoft actually ships one specifically for use with Python. Or try Microsoft Visual C++ Compiler for Python 2.7.

您可以通过安装c++编译器(例如MinGW或Visual c++)来解决这个问题。微软实际上专门为Python提供了一个。或者尝试为Python 2.7使用Microsoft Visual c++编译器。

Often though it's easier to check Christoph's site for your package.

通常情况下,检查Christoph网站上的软件包会更容易。

#2


289  

-- Outdated -- use distribute, not setuptools as described here. --
-- Outdated #2 -- use setuptools as distribute is deprecated.

——过时了——使用发布工具,而不是这里描述的setuptools。-- -过时的#2 -- -使用setuptools,因为发布是不推荐的。

As you mentioned pip doesn't include an independent installer, but you can install it with its predecessor easy_install.

正如您所提到的pip不包含独立的安装程序,但是您可以使用它的前身easy_install来安装它。

So:

所以:

  1. Download the last pip version from here: http://pypi.python.org/pypi/pip#downloads
  2. 从这里下载最后一个pip版本:http://pypi.python.org/pypi/pip#下载
  3. Uncompress it
  4. 解压缩它
  5. Download the last easy installer for Windows: (download the .exe at the bottom of http://pypi.python.org/pypi/setuptools ). Install it.
  6. 下载Windows的最后一个简单安装程序:(在http://pypi.python.org/pypi/setuptools的底部下载.exe)。安装它。
  7. copy the uncompressed pip folder content into C:\Python2x\ folder (don't copy the whole folder into it, just the content), because python command doesn't work outside C:\Python2x folder and then run: python setup.py install
  8. 将未压缩的pip文件夹内容复制到C:\Python2x\文件夹(不要将整个文件夹复制到其中,只复制内容),因为python命令在C:\Python2x文件夹之外不能工作,然后运行:python安装。py安装
  9. Add your python C:\Python2x\Scripts to the path
  10. 将python C:\Python2x\脚本添加到路径中

You are done.

你是做。

Now you can use pip install package to easily install packages as in Linux :)

现在,您可以使用pip安装包轻松地安装包,就像在Linux中一样:)

#3


208  

2014 UPDATE:

2014年更新:

1) If you have installed Python 3.4 or later, pip is included with Python and should already be working on your system.

1)如果您已经安装了Python 3.4或更高版本,则Python中包含pip,并且应该已经在系统上工作了。

2) If you are running a version below Python 3.4 or if pip was not installed with Python 3.4 for some reason, then you'd probably use pip's official installation script get-pip.py. The pip installer now grabs setuptools for you, and works regardless of architecture (32-bit or 64-bit).

2)如果您正在运行一个Python 3.4以下的版本,或者由于某些原因,pip没有安装到Python 3.4中,那么您可能会使用pip的官方安装脚本get-pi .py。pip安装程序现在为您获取setuptools,并且可以在任何架构(32位或64位)下工作。

The installation instructions are detailed here and involve:

这里详细介绍了安装说明,包括:

To install or upgrade pip, securely download get-pip.py.

安装或升级pip,安全下载get-pi .py。

Then run the following (which may require administrator access):

然后运行以下(可能需要管理员访问):

python get-pip.py

To upgrade an existing setuptools (or distribute), run pip install -U setuptools

要升级现有的setuptools(或分发),请运行pip install -U setuptools

I'll leave the two sets of old instructions below for posterity.

我将把这两套旧的说明留给子孙后代。

OLD Answers:

古老的答案:

For Windows editions of the 64 bit variety - 64-bit Windows + Python used to require a separate installation method due to ez_setup, but I've tested the new distribute method on 64-bit Windows running 32-bit Python and 64-bit Python, and you can now use the same method for all versions of Windows/Python 2.7X:

64位的Windows版本- 64位Windows + Python使用需要一个单独的安装方法由于ez_setup,但是我测试了新的分配方法在64位Windows Python Python运行32位和64位,现在你可以使用相同的方法对所有版本的Windows / Python 2.7 x:

OLD Method 2 using distribute:

旧方法2使用分布:

  1. Download distribute - I threw mine in C:\Python27\Scripts (feel free to create a Scripts directory if it doesn't exist.
  2. 下载发行版——我在C:\Python27\脚本(如果脚本不存在的话,请随意创建一个脚本目录。
  3. Open up a command prompt (on Windows you should check out conemu2 if you don't use PowerShell) and change (cd) to the directory you've downloaded distribute_setup.py to.
  4. 打开命令提示符(在Windows上,如果不使用PowerShell,应该检查conemu2)并将(cd)更改为已下载的distribute_setup目录。py。
  5. Run distribute_setup: python distribute_setup.py (This will not work if your python installation directory is not added to your path - go here for help)
  6. 运行distribute_setup:python distribute_setup。py(如果您的python安装目录没有添加到您的路径中,这将无法工作——请到这里寻求帮助)
  7. Change the current directory to the Scripts directory for your Python installation (C:\Python27\Scripts) or add that directory, as well as the Python base installation directory to your %PATH% environment variable.
  8. 将当前目录更改为Python安装的脚本目录(C:\Python27\Scripts),或者将该目录以及Python基础安装目录添加到您的%PATH% environment变量中。
  9. Install pip using the newly installed setuptools: easy_install pip
  10. 使用新安装的setuptools: easy_install pip安装pip

The last step will not work unless you're either in the directory easy_install.exe is located in (C:\Python27\Scripts would be the default for Python 2.7), or you have that directory added to your path.

除非您在easy_install目录中,否则最后一步将不起作用。exe位于(C:\Python27\脚本将是Python 2.7的默认),或者您将该目录添加到您的路径中。

OLD Method 1 using ez_setup:

使用ez_setup的旧方法1:

from the setuptools page --

从setuptools页面——

Download ez_setup.py and run it; it will download the appropriate .egg file and install it for you. (Currently, the provided .exe installer does not support 64-bit versions of Python for Windows, due to a distutils installer compatibility issue.

下载ez_setup。py和运行它;它将下载适当的.egg文件并为您安装它。(目前,由于distutils安装程序兼容性问题,提供的.exe安装程序不支持Windows的64位Python版本。

After this, you may continue with:

在此之后,你可以继续:

  1. Add c:\Python2x\Scripts to the Windows path (replace the x in Python2x with the actual version number you have installed)
  2. 将c:\Python2x\脚本添加到Windows路径(用你安装的实际版本号替换Python2x中的x)
  3. Open a new (!) DOS prompt. From there run easy_install pip
  4. 打开一个新的(!)DOS提示符。从那里运行easy_install pip

#4


183  

2016+ Update:

2016 +更新:

These answers are outdated or otherwise wordy and difficult.

这些答案要么过时了,要么冗长而困难。

If you've got Python 3.4+ or 2.7.9+, it will be installed by default on Windows. Otherwise, in short:

如果您有Python 3.4+或2.7.9+,它将在Windows上默认安装。否则,简而言之:

  1. Download the pip installer: https://bootstrap.pypa.io/get-pip.py
  2. 下载pip安装程序:https://bootstrap.pypa.io/get-pip.py
  3. If paranoid, inspect file to confirm it isn't malicious (must b64 decode).
  4. 如果是偏执狂,检查文件以确认它不是恶意的(必须b64解码)。
  5. Open a console in the download folder as Admin and run get-pip.py. Alternatively, right-click its icon in Explorer and choose the "run as Admin...".
  6. 在下载文件夹中打开一个控制台,作为Admin并运行get-pip.py。或者,在资源管理器中右键单击它的图标并选择“作为管理员运行…”。

The new binaries pip.exe (and the deprecated easy_install.exe) will be found in the "%ProgramFiles%\PythonXX\Scripts" folder (or similar), which is likely not in your PATH variable. I recommend adding it.

新的二进制文件皮普。exe(和已废弃的easy_install.exe)将在“%ProgramFiles%\PythonXX\Scripts”文件夹(或类似的文件夹)中找到,它可能不在您的PATH变量中。我建议添加它。

#5


42  

Python 3.4, which was released in March 2014, comes with pip included:
http://docs.python.org/3.4/whatsnew/3.4.html
So since the release of Python 3.4, the up-to-date way to install pip on Windows is to just install Python. When sticking to all defaults during installation, pip will be installed to
C:\Python34\Scripts\pip3.exe.

2014年3月发布的Python 3.4附带了pip: http://docs.python.org/3.4/whatsnew/3.4.html,所以自从Python 3.4发布以来,在Windows上安装pip的最新方法就是安装Python。当在安装过程中坚持所有默认设置时,pip将被安装到C:\Python34\脚本\pip3.exe上。

#6


37  

When I have to use Windows, I use ActivePython, which automatically adds everything to your PATH and includes a package manager called PyPM which provides binary package management making it faster and simpler to install packages.

当我必须使用Windows时,我使用ActivePython,它会自动将所有内容添加到您的路径中,并包括一个名为PyPM的包管理器,它提供二进制包管理,使安装包更快、更简单。

pip and easy_install aren't exactly the same thing, so there are some things you can get through pip but not easy_install and vice versa.

pip和easy_install并不是完全一样的东西,所以有些东西可以通过pip而不是easy_install,反之亦然。

My recommendation is that you get ActivePython Community Edition and don't worry about the huge hassle of getting everything set up for Python on Windows. Then, you can just use pypm.

我的建议是,您可以获得ActivePython社区版,并且不必担心在Windows上为Python设置所有内容的巨大麻烦。然后,你可以使用pypm。

In case you want to use pip you have to check the PyPM option in the ActiveState installer. After installation you only need to logoff and log on again, and pip will be available on the commandline, because it is contained in the ActiveState installer PyPM option and the paths have been set by the installer for you already. PyPM will also be available, but you do not have to use it.

如果您想使用pip,您必须在ActiveState安装程序中检查PyPM选项。安装之后,您只需注销并再次登录,pip将在命令行上可用,因为它包含在ActiveState installer PyPM选项中,并且安装程序已经为您设置了路径。PyPM也可以使用,但是您不必使用它。

#7


34  

The up-to-date way is to use Windows' package manager Chocolatey.

最新的方法是使用Windows的package manager Chocolatey。

Once this is installed, all you have to do is open a command prompt and run the following the three commands below, which will install Python 2.7, easy_install and pip. It will automatically detect whether you're on x64 or x86 Windows.

安装完成后,您只需打开命令提示符并运行以下三个命令,它们将安装Python 2.7、easy_install和pip。它将自动检测您是在x64还是x86 Windows上。

cinst python
cinst easy.install
cinst pip

All of the other Python packages on the Chocolatey Gallery can be found here.

巧克力画廊里所有其他的Python软件包都可以在这里找到。

#8


26  

Update March 2015

2015年3月更新

Python 2.7.9 and later (on the Python 2 series), and Python 3.4 and later include pip by default, so you may have pip already.

Python 2.7.9和后来(在Python 2系列中)和Python 3.4,之后在默认情况下包含pip,所以您可能已经有了pip。

If you don't, run this one line command on your prompt (which may require administrator access):

如果没有,请在提示符(可能需要管理员访问)上运行这一行命令:

python -c "exec('try: from urllib2 import urlopen \nexcept: from urllib.request import urlopen');f=urlopen('https://bootstrap.pypa.io/get-pip.py').read();exec(f)"

It will install pip. If Setuptools is not already installed, get-pip.py will install it for you too.

它将安装脉冲。如果Setuptools还没有安装,get-pip。py也会为您安装的。

As mentioned in comments, the above command will download code from the Pip source code repository at GitHub, and dynamically run it at your environment. So be noticed that this is a shortcut of the steps download, inspect and run, all with a single command using Python itself. If you trust Pip, proceed without doubt.

正如在注释中提到的,上面的命令将从GitHub的Pip源代码存储库中下载代码,并在您的环境中动态地运行它。因此请注意,这是使用Python本身的一个命令下载、检查和运行步骤的快捷方式。如果你信任匹普,毫无疑问地前进。

Be sure that your Windows environment variable PATH includes Python's folders (for Python 2.7.x default install: C:\Python27 and C:\Python27\Scripts, for Python 3.3x: C:\Python33 and C:\Python33\Scripts, and so on).

请确保您的Windows环境变量路径包含Python的文件夹(适用于Python 2.7)。x默认安装:C:\Python27和C:\Python27\脚本,用于Python 3.3x: \Python33和C:\Python33\脚本,等等)。

#9


24  

Installers

I've built Windows installers for both distribute and pip here (the goal being to use pip without having to either bootstrap with easy_install or save and run Python scripts):

我在这里为分布式和pip构建了Windows安装程序(目标是使用pip,而无需使用easy_install或保存和运行Python脚本):

On Windows, simply download and install first distribute, then pip from the above links. The distribute link above does contain stub .exe installers, and these are currently 32-bit only. I haven't tested the effect on 64-bit Windows.

在Windows上,只需下载并安装第一个分发版,然后从上面的链接输入pip。上面的分发链接确实包含存根.exe安装程序,这些安装程序目前只有32位。我还没有测试64位Windows的效果。

Building on Windows

The process to redo this for new versions is not difficult, and I've included it here for reference.

为新版本重做此操作的过程并不困难,我将它包含在这里以供参考。

Building distribute

In order to get the stub .exe files, you need to have a Visual C++ compiler (it is apparently compilable with MinGW as well)

为了获得存根.exe文件,您需要一个Visual c++编译器(显然,它也可以用MinGW编译)

hg clone https://bitbucket.org/tarek/distribute
cd distribute
hg checkout 0.6.27
rem optionally, comment out tag_build and tag_svn_revision in setup.cfg
msvc-build-launcher.cmd
python setup.py bdist_win32
cd ..
echo build is in distribute\dist

Building pip

git clone https://github.com/pypa/pip.git
cd pip
git checkout 1.1
python setup.py bdist_win32
cd ..
echo build is in pip\dist

#10


16  

The following works for Python 2.7. Save this script and launch it:

https://raw.github.com/pypa/pip/master/contrib/get-pip.py

Pip is installed, then add the path to your environment :

以下代码适用于Python 2.7。保存该脚本并启动:安装了https://raw.github.com/pypa/pip/master/后悔器/get- Pip .py Pip,然后将路径添加到您的环境:

C:\Python27\Scripts

Finally

最后

pip install virtualenv

Also you need Microsoft Visual C++ 2008 Express to get the good compiler and avoid these kind of messages when installing packages:

您还需要Microsoft Visual c++ 2008 Express获得好的编译器,并在安装包时避免这些消息:

error: Unable to find vcvarsall.bat

If you have a 64-bit version of Windows 7, you may read 64-bit Python installation issues on 64-bit Windows 7 to successfully install the Python executable package (issue with registry entries).

如果您有一个64位版本的Windows 7,您可以阅读64位Windows 7上的64位Python安装问题,以成功安装Python可执行包(与注册表项一起发布)。

#11


13  

To install pip globally on Python 2.x, easy_install appears to be the best solution as Adrián states.

要在Python 2上全局安装pip。正如Adrian所言,easy_install似乎是最好的解决方案。

However the installation instructions for pip recommend using virtualenv since every virtualenv has pip installed in it automatically. This does not require root access or modify your system Python installation.

但是pip的安装说明推荐使用virtualenv,因为每个virtualenv都自动安装pip。这并不需要根访问或修改系统Python安装。

Installing virtualenv still requires easy_install though.

安装virtualenv仍然需要easy_install。

2018 update:

2018年更新:

Python 3.3+ now includes the venv module for easily creating virtual environments like so:

Python 3.3+现在包含了venv模块,可以轻松创建这样的虚拟环境:

python3 -m venv /path/to/new/virtual/environment

python3 - m venv /道路/ /新/虚拟环境

See documentation for different platform methods of activating the environment after creation, but typically one of:

关于创建后激活环境的不同平台方法,请参阅文档,但通常有以下几种方法:

$ source <venv>/bin/activate 

C:\> <venv>\Scripts\activate.bat

#12


12  

To use pip, it is not mandatory that you need to install pip in the system directly. You can use it through virtualenv. What you can do is follow these steps:

要使用pip,您不需要在系统中直接安装pip。您可以通过virtualenv使用它。你所能做的就是遵循以下步骤:

  • Download virtualenv tar.gz file from https://pypi.python.org/pypi/virtualenv
  • 下载virtualenv焦油。从https://pypi.python.org/pypi/virtualenv gz文件
  • Unzip it with 7zip or some other tool
  • 用7zip或其他工具解压。

We normally need to install Python packages for one particular project. So, now create a project folder, let’s say myproject.

我们通常需要为一个特定的项目安装Python包。现在创建一个项目文件夹,比如说myproject。

  • Copy the virtualenv.py file from the decompressed folder of virtualenv, and paste inside the myproject folder
  • 复制virtualenv。从virtualenv的解压缩文件夹中提取的py文件,并粘贴到myproject文件夹中

Now create a virtual environment, let’s say myvirtualenv as follows, inside the myproject folder:

现在创建一个虚拟环境,假设myvirtualenv如下,在myproject文件夹中:

python virtualenv.py myvirtualenv

It will show you:

它将向您展示:

New python executable in myvirtualenv\Scripts\python.exe
Installing setuptools....................................done.
Installing pip.........................done.

Now your virtual environment, myvirtualenv, is created inside your project folder. You might notice, pip is now installed inside you virtual environment. All you need to do is activate the virtual environment with the following command.

现在,您的虚拟环境myvirtualenv在项目文件夹中创建。您可能会注意到,pip现在已经安装在您的虚拟环境中。您需要做的就是使用以下命令激活虚拟环境。

myvirtualenv\Scripts\activate

You will see the following at the command prompt:

您将在命令提示符中看到以下内容:

(myvirtualenv) PATH\TO\YOUR\PROJECT\FOLDER>pip install package_name

Now you can start using pip, but make sure you have activated the virtualenv looking at the left of your prompt.

现在您可以开始使用pip,但是请确保您已经激活了查看提示符左边的virtualenv。

This is one of the easiest way to install pip i.e. inside virtual environment, but you need to have virtualenv.py file with you.

这是在虚拟环境中安装pip最简单的方法之一,但是您需要使用virtualenv。py文件与你在一起时的感觉。

For more ways to install pip/virtualenv/virtualenvwrapper, you can refer to thegauraw.tumblr.com.

要了解更多安装pip/virtualenv/virtualenvwrapper的方法,可以参考thegauraw.tumblr. tumblr。

#13


11  

I just wanted to add one more solution for those having issues installing setuptools from Windows 64-bit. The issue is discussed in this bug on python.org and is still unresolved as of the date of this comment. A simple workaround is mentioned and it works flawlessly. One registry change did the trick for me.

我只是想为那些在Windows 64位中安装setuptools的问题添加一个解决方案。这个问题在python.org上的这个bug中得到了讨论,并且在这个评论的日期仍然没有解决。上面提到了一个简单的解决方案,它可以完美地工作。一次注册表更改就成功了。

Link: http://bugs.python.org/issue6792#

链接:http://bugs.python.org/issue6792

Solution that worked for me...:

对我有用的解决方案……

Add this registry setting for 2.6+ versions of Python:

为2.6+版本的Python添加注册表设置:

 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.6\InstallPath]
 @="C:\\Python26\\"

This is most likely the registry setting you will already have for Python 2.6+:

这很可能是您已经为Python 2.6+设置的注册表设置:

 [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath]
 @="C:\\Python26\\"

Clearly, you will need to replace the 2.6 version with whatever version of Python you are running.

显然,您需要用正在运行的Python版本替换2.6版本。

#14


11  

Updated at 2016 : Pip should already be included in Python 2.7.9+ or 3.4+, but if for whatever reason it is not there, you can use the following one-liner.

在2016年更新:Pip应该已经包含在Python 2.7.9+或3.4+中,但是如果出于某种原因它不存在,您可以使用以下一行代码。

  • Download https://bootstrap.pypa.io/get-pip.py and run it with Administrator permission python get-pip.py (If you are on Linux, use sudo python get-pip.py)
  • 下载:https://bootstrap.pypa.io/get-pip。py和运行它的管理员权限python get-pip。py(如果您在Linux上,请使用sudo python get-pi .py)

PS:

PS:

  1. This should already be satisfied in most cases but, if necessary, be sure that your environment variable PATH includes Python's folders (for example, Python 2.7.x on Windows default install: C:\Python27 and C:\Python27\Scripts, for Python 3.3x: C:\Python33 and C:\Python33\Scripts, etc)

    这在大多数情况下应该已经得到满足,但是如果需要,请确保您的环境变量路径包含Python的文件夹(例如,Python 2.7)。C:\Python27和C:\Python27\脚本,适用于Python 3.3x: C:\Python33和C:\Python33\脚本,等等)

  2. I encounter same problem and then found such perhaps easiest way (one liner!) mentioned on official website here: http://www.pip-installer.org/en/latest/installing.html

    我遇到了同样的问题,然后在官方网站上找到了这样可能最简单的方法:http://www.pip-installer.org/en/latest/installing.html。

Can't believe there are so many lengthy (perhaps outdated?) answers out there. Feeling thankful to them but, please up-vote this short answer to help more new comers!

真不敢相信有这么多冗长(也许已经过时了?)的答案。感谢他们,但是,请投票支持这个简短的回答,以帮助更多的新来者!

#15


10  

The best way I found so far, is just two lines of code:

到目前为止,我发现的最好的方法,就是两行代码:

curl http://python-distribute.org/distribute_setup.py | python
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

It was tested on Windows 8 with PowerShell, Cmd, and Git Bash (MinGW).

它在Windows 8上使用PowerShell、Cmd和Git Bash (MinGW)进行测试。

And you probably want to add the path to your environment. It's somewhere like C:\Python33\Scripts.

您可能想要添加路径到您的环境。某个地方像C:\ Python33 \脚本。

#16


9  

PythonXY comes with pip included, among others.

PythonXY和pip包括在内。

#17


9  

Here how to install pip with easy way.

这里介绍了如何用简单的方法安装pip。

  1. copy and paste these content in a file as get-pip.py
  2. 将这些内容复制粘贴到一个文件中作为get-pi .py
  3. copy and paste get-pip.py into python folder.C:\Python27
  4. 复制和粘贴get-pip。py到python folder.C:\ Python27
  5. Double click to get-pip.py file.it will install pip to your computer.
  6. 双击get-pip。py文件。它会在你的电脑上安装pip。
  7. Now you have to add C:\Python27\Scripts path to your enviroment variable.Because it includes pip.exe file.
  8. 现在您必须添加C:\Python27\脚本路径到您的环境变量。因为它包含了皮普。exe文件。
  9. Now you are ready to use pip. Open cmd and type as
    pip install package_name
  10. 现在可以使用pip了。打开cmd并输入pip安装package_name

#18


8  

I use the cross-platform Anaconda package manager from continuum.io on Windows and it is reliable. It has virtual environment management and a fully featured shell with common utilities (e.g. conda, pip).

我使用了来自continuum的跨平台的Anaconda包管理器。操作简单,操作可靠。它具有虚拟环境管理和功能齐全的shell,具有公共实用程序(例如conda、pip)。

> conda install <package>               # access distributed binaries

> pip install <package>                 # access PyPI packages 

conda also comes with binaries for libraries with non-Python dependencies, e.g. pandas, numpy, etc. This proves useful particularly on Windows as it can be hard to correctly compile C dependencies.

conda还为具有非python依赖项的库提供了二进制文件,例如panda、numpy等。这在Windows上尤其有用,因为很难正确编译C依赖项。

#19


8  

For latest Python Download - I have python 3.6 on windows. You don't have to wonder everything you need is there , take a breath i will show you how to do it.

对于最新的Python下载——我在windows上有Python 3.6。你不必去想你需要的一切都在那里,深呼吸,我来告诉你怎么做。

  1. make sure where you install python for me its was in the following directory 如何在Windows上安装pip ?
  2. 请确保您为我安装了python,它在以下目录中

Now , lets add python and pip into environment variable path settings if you are on windows, so that typing pip or python anywhere call python aor pip from where they are installed.

现在,如果您在windows上,那么让我们将python和pip添加到环境变量路径设置中,这样输入pip或python anywhere就可以从它们安装的位置调用python aor pip。

So, PIP is found under the folder in above screen "SCRIPTS" Lets add Python and PIP in environment variable path. 如何在Windows上安装pip ?

因此,PIP是在屏幕上的“脚本”文件夹下找到的,允许在环境变量路径中添加Python和PIP。

Almost Done , Let test with CMD to install goole package using pip.

差不多完成了,让CMD测试用pip安装goole包。

pip install google

如何在Windows上安装pip ?

BYE BYE!

再见再见!

#20


6  

I wrote this pip install script that wraps both the ez_setup.py and get-pip.py install scripts that were mentioned in Gringo Suave's answer (and runs a pip install --upgrade setuptools for the latest setuptools version once pip is installed).

我编写了这个pip安装脚本,它封装了两个ez_setup。py和get-pip。py安装脚本在Gringo Suave的答案中被提及(并运行一个pip安装——升级setuptools,用于安装pip之后的最新setuptools版本)。

Clone the repository with:

克隆存储库:

git clone https://github.com/chrissimpkins/pip-installer.git

Or download a .zip archive:

或下载。zip档案:

https://github.com/chrissimpkins/pip-installer/archive/master.zip

https://github.com/chrissimpkins/pip-installer/archive/master.zip

And then run the pipinstall.py script in the top level of the repository directory:

然后运行pipinstall。存储库目录顶层的py脚本:

python pipinstall.py

This will give you the latest releases for both applications. It's safe to remove the script repository after the install.

这将为您提供这两个应用程序的最新版本。在安装之后删除脚本存储库是安全的。

#21


6  

I had some issues installing in different ways when I followed instructions here. I think it's very tricky to install in every Windows environment in the same way. In my case I need Python 2.6, 2.7 and 3.3 in the same machine for different purposes so that's why I think there're more problems. But the following instructions worked perfectly for me, so might be depending on your environment you should try this one:

当我按照这里的说明安装时,我有一些不同的问题。我认为以同样的方式在每个Windows环境中安装是非常棘手的。在我的例子中,为了不同的目的,我需要在同一台机器中使用Python 2.6、2.7和3.3,所以我认为还有更多的问题。但是以下的指导对我来说非常有效,所以你应该根据你的环境来尝试一下:

http://docs.python-guide.org/en/latest/starting/install/win/

http://docs.python-guide.org/en/latest/starting/install/win/

Also, due to the different environments I found incredible useful to use Virtual Environments, I had websites that use different libraries and it's much better to encapsulate them into a single folder, check out the instructions, briefly if PIP is installed you just install VirtualEnv:

此外,由于使用虚拟环境的环境不同,我发现使用虚拟环境非常有用,我有使用不同库的网站,最好将它们封装到一个文件夹中,查看说明,简单地说,如果安装了PIP,您只需安装VirtualEnv:

pip install virtualenv

Into the folder you have all your files run

将所有文件运行到文件夹中

virtualenv venv

And seconds later you have a virtual environment with everything in venv folder, to activate it run venv/Scripts/activate.bat (deactivate the environment is easy, use deactivate.bat). Every library you install will end up in venv\Lib\site-packages and it's easy to move your whole environment somewhere.

几秒钟后,您就拥有了一个虚拟环境,其中包含venv文件夹中的所有内容,以激活它运行venv/Scripts/activate。bat(关闭环境很容易,使用deactivator .bat)。你安装的每一个库都将以venv\Lib\site-packages结尾,并且很容易将整个环境移动到某个地方。

The only downside I found is some code editors can't recognize this kind of environments, and you will see warnings in your code because imported libraries are not found. Of course there're tricky ways to do it but it would be nice editors keep in mind Virtual Environments are very normal nowadays.

我发现的唯一缺点是有些代码编辑器不能识别这种环境,您将在代码中看到警告,因为没有找到导入的库。当然,有一些巧妙的方法可以做到这一点,但要让编辑们记住虚拟环境是很正常的。

Hope it helps.

希望它可以帮助。

#22


6  

  1. Download script: https://raw.github.com/pypa/pip/master/contrib/get-pip.py
  2. 下载脚本:https://raw.github.com/pypa/pip/master/contrib/get-pip.py
  3. Save it on drive somewhere like C:\pip-script\get-pip.py
  4. 把它保存在C:\pip-script\get-pi .py这样的驱动器上
  5. Navigate to that path from command prompt and run " python get-pip.py "
  6. 从命令提示符导航到该路径并运行“python get-pip”。py”

Guide link: http://www.pip-installer.org/en/latest/installing.html#install-pip

指南链接:http://www.pip-installer.org/en/latest/installing.html install-pip

Note: Make sure scripts path like this (C:\Python27\Scripts) is added int %PATH% environment variable as well.

注意:确保像这样的脚本路径(C:\Python27\脚本)也添加了int % path %环境变量。

#23


3  

It's very simple:

这是非常简单的:

Step 1: wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
Step 2: wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
Step 2: python ez_setup.py
Step 3: python get-pip.py

(Make sure your Python and Python script directory (for example, C:\Python27 and C:\Python27\Scripts) are in the PATH.)

(确保您的Python和Python脚本目录(例如,C:\Python27和C:\Python27\Scripts)在路径中)。

#24


3  

Working as of Feb 04 2014 :):

2014年2月04日工作:

If you have tried installing pip through the Windows installer file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip as suggested by @Colonel Panic, you might have installed the pip package manager successfully, but you might be unable to install any packages with pip. You might also have got the same SSL error as I got when I tried to install Beautiful Soup 4 if you look in the pip.log file:

如果您尝试通过http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip的Windows安装文件安装pip,就像@Colonel Panic建议的那样,您可能已经成功安装了pip包管理器,但是您可能无法使用pip安装任何包。如果查看pip,您可能也会得到与我尝试安装漂亮的Soup 4时相同的SSL错误。日志文件:

Downloading/unpacking beautifulsoup4
  Getting page https://pypi.python.org/simple/beautifulsoup4/
  Could not fetch URL https://pypi.python.org/simple/beautifulsoup4/: **connection error: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed**
  Will skip URL https://pypi.python.org/simple/beautifulsoup4/ when looking for download links for beautifulsoup4

The problem is an issue with an old version of OpenSSL being incompatible with pip 1.3.1 and above versions. The easy workaround for now, is to install pip 1.2.1, which does not require SSL:

问题是旧版本的OpenSSL与pip 1.3.1及以上版本不兼容。目前最简单的解决方案是安装pip 1.2.1,它不需要SSL:

Installing Pip on Windows:

皮普在Windows上安装:

  1. Download pip 1.2.1 from https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz
  2. 从https://pypi.python.org/packages/source/p/pip/pip- 1.2.1.1.tar.gz下载pip 1.2.1
  3. Extract the pip-1.2.1.tar.gz file
  4. 提取pip-1.2.1.tar。gz文件
  5. Change directory to the extracted folder: cd <path to extracted folder>/pip-1.2.1
  6. 将目录更改为提取文件夹:cd <到提取文件夹> /pip-1.2.1的路径
  7. Run python setup.py install
  8. python运行设置。py安装
  9. Now make sure C:\Python27\Scripts is in PATH because pip is installed in the C:\Python27\Scripts directory unlike C:\Python27\Lib\site-packages where Python packages are normally installed
  10. 现在请确保C:\Python27\脚本在路径中,因为pip安装在C:\Python27\Scripts目录中,不像C:\Python27\Lib\ Lib\site-packages, Python包通常安装在C:\Python27\Scripts目录中

Now try to install any package using pip.

现在尝试使用pip安装任何包。

For example, to install the requests package using pip, run this from cmd:

例如,要使用pip安装请求包,请运行cmd:

pip install requests

Whola! requests will be successfully installed and you will get a success message.

Whola !请求将成功安装,您将获得一条成功消息。

#25


3  

pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4 binaries downloaded from python.org, but you'll need to upgrade pip.

如果您正在使用Python 2 >=2.7.9或Python 3 >=3.4从python.org下载的二进制文件,则已经安装了pip,但是您需要升级pip。

On Windows upgrade can be done easily

在Windows上升级很容易

Go to Python command line and run below Python command

转到Python命令行并在Python命令下运行

python -m pip install -U pip

python -m pip安装-U pip。

Installing with get-pip.py

安装与get-pip.py

Download get-pip.py in the same folder or any other folder of your choice. I am assuming you will download it in the same folder from you have python.exe file and run this command

下载get-pip。在同一文件夹或您选择的任何其他文件夹中的py。我假设您将在您拥有python的同一文件夹中下载它。执行exe文件并运行此命令

python get-pip.py

Pip's installation guide is pretty clean and simple.

Pip的安装指南非常简洁。

Using this you should be able to get started with Pip in under two minutes.

使用这个工具,您应该能够在两分钟内开始使用Pip。

#26


2  

Just download setuptools-15.2.zip (md5), from here https://pypi.python.org/pypi/setuptools#windows-simplified , and run ez_setup.py.

只是下载setuptools - 15.2。zip (md5),从这里开始,https://pypi.python.org/pypi/setuptools# windowssimplified,运行ez_setup.py。

#27


2  

Alternatively, you can get pip-Win which is an all-in-one installer for pip and virtualenv on Windows and its GUI.

另外,您还可以获得pip- win,它是pip和virtualenv在Windows和它的GUI上的一体式安装程序。

  • Switch from one Python interpreter (i.e. version) to another (including py and pypy)
  • 从一个Python解释器(即版本)切换到另一个(包括py和pypy)
  • See all installed packages, and whether they are up-to-date
  • 查看所有已安装的包,以及它们是否最新
  • Install or upgrade a package, or upgrade pip itself
  • 安装或升级包,或升级pip本身。
  • Create and delete virtual environments, and switch between them
  • 创建和删除虚拟环境,并在它们之间进行切换
  • Run the IDLE or another Python script, with the selected interpreter
  • 使用所选的解释器运行空闲或另一个Python脚本

#28


2  

you have to get the get_pip.py file search it on google copy from there and save it locally in c drive in pip directory

您必须获得get_pip。py文件从那里在谷歌拷贝上搜索它,并将它本地保存在pip目录的c驱动器中

#29


2  

Sometime it easier to understand when you use IDE:

有时使用IDE更容易理解:

  • Install PyCharm
  • 安装PyCharm
  • And create virtual environment it will automatically install pip
  • 并创建虚拟环境,自动安装pip
  • Then in code you could install any python packages 如何在Windows上安装pip ?
  • 然后在代码中可以安装任何python包

#30


1  

I think the question makes it seem like the answer is simpler than it really is. Running of pip will sometimes require native compilation of a module (64-bit Numpy is a common example of that). In order for pip's compilation to succeed, you need Python which was compiled with the same version of MSVC as the one pip is using. Standard Python distributions are compiled with MSVC 2008. You can install an Express version of VC2008, but it is not maintained. Your best bet is to get an express version of a later MSVC and compile Python. Then PIP and Python will be using the same MSVC version.

我认为这个问题让人觉得答案比实际要简单。pip的运行有时需要对模块进行本机编译(64位Numpy是一个常见的例子)。为了使pip编译成功,您需要使用与pip使用的MSVC版本相同的Python。标准的Python发行版是使用MSVC 2008编译的。您可以安装VC2008的一个快速版本,但是没有维护它。最好的办法是获得一个新的MSVC的快速版本并编译Python。然后PIP和Python将使用相同的MSVC版本。