• Windows 下 Python easy_install 的安装


    转载纯属为了学习及方便管理。
    转载地址:http://www.cnblogs.com/zhuyp1015/archive/2012/07/17/2596495.html


    下载安装python安装工具
    下载地址:http://pypi.python.org/pypi/setuptools 可以找到正确的版本进行下载。win7 32位可以下载setuptools-0.6c11.win32-py2.7.exe 。


    注意:win7 64位必须使用ez_setup.py进行安装。方法是下载ez_setup.py后,在cmd下执行 python ez_setup.py,即可自动安装setuptools。目前没有直接的exe安装版本。

    注意2:更新了更简单的办法,可以直接跳转到最后面

    下载完成后双击执行安装文件,即可在D:Program Filespython2.7scripts下安装easy_install。包含一个easy_install.exe,然后进行环境变量设置,在系统环境变量中做如下设置:
    (也就是将D:Program Filespython2.7scripts添加到环境变量中)
    
     

     
    此时可以在控制台看easy_install 是否安装上了。
     
    Microsoft Windows [版本 6.1.7600]
    版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

    C:Userszhuyupeng>easy_install
    error: No urls, filenames, or requirements specified (see --help)
     
    上面这种方式不正确,需要使用下面的方式:

    C:Userszhuyupeng>easy_install virtualenv
    Searching for virtualenv
    Best match: virtualenv 1.7.2
    Processing virtualenv-1.7.2-py2.7.egg
    virtualenv 1.7.2 is already the active version in easy-install.pth
    Installing virtualenv-script.py script to D:Program FilesPython2.7Scripts
    Installing virtualenv.exe script to D:Program FilesPython2.7Scripts
    Installing virtualenv.exe.manifest script to D:Program FilesPython2.7Scripts
    Installing virtualenv-2.7-script.py script to D:Program FilesPython2.7Scripts

    Installing virtualenv-2.7.exe script to D:Program FilesPython2.7Scripts
    Installing virtualenv-2.7.exe.manifest script to D:Program FilesPython2.7Scri
    pts

    Using d:program filespython2.7libsite-packagesvirtualenv-1.7.2-py2.7.egg
    Processing dependencies for virtualenv
    Finished processing dependencies for virtualenv

    安装lxml:
    C:Userszhuyupeng>
     
     
    如果直接使用:
    easy_install lxml 
    
    
    
    C:Userszhuyupeng> easy_install lxml 则会出现下面问题:
    ERROR:‘xslt-config’ 不是内部或外部命令
    make sure the developing packages of libxml2 and libxslt are installed windows
     
     
     
    可以使用安装.egg 文件的方式来安装:
    网站上下载对应的lxml .egg 文件
    然后使用下面的方式来安装:
    C:Userszhuyupeng> easy_install D:Program FilesPython2.7lxml-2.3.py2.7.win32.egg
     
    注:对于*.exe 文件这样也可以安装
     
    通过这样的方式就可以安装成功了:
    可以通过在控制台输入:easy_install lxml 来查看:
     
    Microsoft Windows [版本 6.1.7600]
    版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

    C:Userszhuyupeng>easy_install lxml
    Searching for lxml
    Best match: lxml 2.3.4
    Adding lxml 2.3.4 to easy-install.pth file

    Using d:program filespython2.7libsite-packages
    Processing dependencies for lxml
    Finished processing dependencies for lxml

    C:Userszhuyupeng>
     
     
    安装了easy_install 之后安装python的库就很简单了,以后需要安装python的库的话则直接在命令行使用
    easy_install + libname
     
    比如:

    C:Userszhuyupeng>easy_install numpy
    Searching for numpy
    ...
    Processing dependencies for numpy
    Finished processing dependencies for numpy


    这是下载下来再安装的:
    C:Userszhuyupeng>easy_install "D:Program FilesPython2.7matplotlib-1.1.0.win
    32-py2.7.exe"
    ...
    Processing dependencies for matplotlib==1.1.0
    Finished processing dependencies for matplotlib==1.1.0

    C:Userszhuyupeng>
     
     
    附一个画爱心的程序:
    复制代码
    """
    '17*x^2 - 16*|x|*y + 17*y^2 = 225'
    """
    
    import numpy as np
    import matplotlib.pyplot as plt
    
    X = np.arange(-5.0, 5.0, 0.1)
    Y = np.arange(-5.0, 5.0, 0.1)
    
    x, y = np.meshgrid(X, Y)
    f = 17 * x ** 2 - 16 * np.abs(x) * y + 17 * y ** 2 - 225
    
    fig = plt.figure()
    cs = plt.contour(x, y, f, 0, colors = 'r')
    plt.show()
    复制代码

    20:00 2013-12-19

    更简单的办法,只需要输入几个命令就ok了:

    以下是在IDLE中进行的:

    Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32
    Type "copyright", "credits" or "license()" for more information.
    >>> from urllib import urlopen
    >>> data = urlopen('http://peak.telecommunity.com/dist/ez_setup.py')
    >>> open('ez_setup.py','wb').write(data.read())
    >>> exit
    Use exit() or Ctrl-Z plus Return to exit
    >>>

    //++++++++++++++++++++++++++++++++++++++++++++++ 分割线 +++++++++++++++++++++++++++++

    以下是在windows控制台进行的:

    D:ProgramFilePython2.7>python ez_setup.py
    Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-p
    y2.7.egg
    Processing setuptools-0.6c11-py2.7.egg
    Copying setuptools-0.6c11-py2.7.egg to d:programfilepython2.7libsite-package
    s
    Adding setuptools 0.6c11 to easy-install.pth file
    Installing easy_install-script.py script to D:ProgramFilePython2.7Scripts
    Installing easy_install.exe script to D:ProgramFilePython2.7Scripts
    Installing easy_install.exe.manifest script to D:ProgramFilePython2.7Scripts
    Installing easy_install-2.7-script.py script to D:ProgramFilePython2.7Scripts

    Installing easy_install-2.7.exe script to D:ProgramFilePython2.7Scripts
    Installing easy_install-2.7.exe.manifest script to D:ProgramFilePython2.7Scri
    pts

    Installed d:programfilepython2.7libsite-packagessetuptools-0.6c11-py2.7.egg

    Processing dependencies for setuptools==0.6c11
    Finished processing dependencies for setuptools==0.6c11

    总共只需要5个命令:IDLE中4个,windows控制台中1个

    make it simple, make it happen
  • 相关阅读:
    python 导出 mongodb 两张表数据并合并
    堡垒机安装pytorch,mmcv,mmclassification,并训练自己的数据集
    大咖授课+项目实战+工作offer,2022数据智能夏令营火热招募!
    个推CTO谈数据智能与元宇宙:从概念、成因到核心技术
    个推TechDay直播预告 | 6月22日,开启大数据降本提效的破局之道!
    windows10 CUDA11.4+CUDnn+torch+tensorflow环境配置
    linux服务器(centos 7.8)配置深度学习环境
    CentOS 基本命令
    MySQL8.0的my.ini文件位置 windos下
    md5,获取字符串MD5
  • 原文地址:https://www.cnblogs.com/yansjhere/p/4792095.html
Copyright © 2020-2023  润新知