`
leixbo
  • 浏览: 32620 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

python pip 安装

 
阅读更多

pip的安装可参考:http://docs.python-guide.org/en/latest/starting/install/win/

 

 以下部分说明了安装过程

 

Setuptools + Pip

The most crucial third-party Python software of all is Setuptools, which extends the packaging and installation facilities provided by the distutils in the standard library. Once you add Setuptools to your Python system you can download and install any compliant Python software product with a single command. It also enables you to add this network installation capability to your own Python software with very little work.

To obtain the latest version of Setuptools for Windows, run the python script available here: ez_setup.py

You’ll now have a new command available to you: easy_install. It is considered by many to be deprecated, so we will install its replacement: pip. Pip allows for uninstallation of packages, and is actively maintained, unlike easy_install.

To install pip, run the python script available here: get-pip.py

 

以windows为例

 

1.下载ez_setup.py文件安装setuptools

     执行:python $path\ez_setup.py,执行完后可以在python的Scripts目录下看到安装的文件

 

    安装过程中可能会出现以下错误:

        UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in range(128)  

    解决办法:<!--[endif]-->

        注释掉python安装目录lib下的 mimetypes.py中 ctype = ctype.encode(default_encoding) 那部分代码,重新执行python ez_install.py

   

  #try:
      #ctype = ctype.encode(default_encoding) # omit in 3.x!
  #except UnicodeEncodeError:
      #pass

 

    注意:Pip依赖setuptools,如果没有安装setuptools就安装pip会报错提示setuptools或者distribute没有安装

 

2.下载get-pip.py文件

    执行:python $path\get-pip.py

 

    安装完成后可以看到 Successfully installed pip

 

3.添加到系统path中

    查看目录可以看到相应的pip文件在python的Scripts目录下, 然后将该路径添加到系统Path中:D:\Python27\Scripts

 

4 .pip信息查询

     在控制台执行:pip -V 可以看到pip的相关信息

        pip 1.4.1 from d:\program_files\python27\lib\site-packages (python 2.7)

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics