zoukankan      html  css  js  c++  java
  • Python安装模块出错(ImportError: No module named setuptools)解决方法

    Python第三方模块中一般会自带setup.py文件,在Windows环境下,我们只需要使用命令

        cd c:\Temp\foo

        python setup.py install

        两个命令就可以完成第三方模块的安装了。第一个cd命令将当前目前切换到待安装的第三方模块的目录下(这里假设第三方模块解压后的目录为c:\Temp\foo),第二个命令就执行安装了。安装的过程中可能会出现“ImportError: No module named setuptools”的错误提示,这是新手很常遇见的错误提示。不用担心,这是因为Windows环境下Python默认是没有安装setuptools这个模块的,这也是一个第三方模块。下载地址为http://pypi.python.org/pypi/setuptools

        如果是Windows环境的话,下载exe形式的安装程序就可以了(傻瓜式安装,非常快)。安装了setuptools之后,再运行“python setup.py install”就可以方便地安装各种第三方模块了。(安装目录是在Python2.7\Lib\site-packages\中

    怎么安装setuptools工具,windows下采用如下办法:

    The recommended way to install setuptools on Windows is to download ez_setup.py and run it. The script will download the appropriate .egg file and install it for you.

    For best results, uninstall previous versions FIRST (see Uninstalling).

    Once installation is complete, you will find an easy_install.exe program in your Python Scripts subdirectory. For simple invocation and best results, add this directory to your PATH environment variable, if it is not already present.

    python目录会多出一个Scripts文件夹,把scripts加到环境变量的PATH里,就可以了。

        如果是Linux环境的话,可能稍微麻烦一点,可能是笔者能力不够吧。下面简单说一下Linux下setuptools的安装过程。同样是在http://pypi.python.org/pypi/setuptools这个地方下载setuptools-0.6c11-py2.7.egg文件到本地,使用chmod +x setuptools-0.6c11-py2.7.egg命令使文件成为可执行文件。然后运行sudo sh setuptools-0.6c11-py2.7.egg命令完成安装。

        上述方法经笔者测试可行。如果有什么问题,可以留言。

    linux安装:

    shell中输入:

    wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
    tar zxvf setuptools-0.6c11.tar.gz
    cd setuptools-0.6c11
    python setup.py build
    python setup.py install

  • 相关阅读:
    cct,web技术
    cct信息安全
    TFS2010安装与管理
    centos7 opera济览器安装
    Hadoop 的常用组件一览
    Exception in thread "main" java.net.BindException: Address already in use: JVM_Bind
    gcc manual
    5350.support
    meminfo,df,
    WCF
  • 原文地址:https://www.cnblogs.com/youxin/p/3061832.html
Copyright © 2011-2022 走看看