pip与easy_install的安装

来源:互联网 发布:一个字的网络歌曲 编辑:程序博客网 时间:2024/05/21 23:31

关于pip与easy_install的安装,网上一大堆的方法其实都已经过时,

网上能搜的大多数方法是让你先去easy_install的官网下载ez_setup.py,

然后运行安装,


虽然上述方法是可行的,但是我们其实有更好的方法,根据python官网的说明,链接如下

https://packaging.python.org/tutorials/installing-packages/

有如下描述

If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from python.org

you will already have pip and setuptools, but will need to upgrade to the latest version:


也就是说2.7.9和3.4以后,easy_install 和pip已经内置了,所以只要更新下就好了。

------------------------------------------------------------------

我电脑安装的是python,3.6.2

C:\Users\Administrator>python --version
Python 3.6.2


C:\Users\Administrator>easy_install --version
'easy_install' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

可以看到,默认情况下easy_install的目录是不在path中的,


添加python目录下的Scripts 到path中


然后更新下

python -m pip install -U pip setuptools

Installing collected packages: setuptools
  Found existing installation: setuptools 28.8.0
    Uninstalling setuptools-28.8.0:
      Successfully uninstalled setuptools-28.8.0
Successfully installed setuptools-36.2.7



C:\Users\Administrator>python -m pip install -U pip setuptools
Requirement already up-to-date: pip in c:\users\administrator\appdata\local\prog
rams\python\python36-32\lib\site-packages
Requirement already up-to-date: setuptools in c:\users\administrator\appdata\loc
al\programs\python\python36-32\lib\site-packages

------------------------------------------------------------------------------