windows7 下安装python2.7 setuptools pip

1.安装python2.7

从以下地址下载最新版本python. 注意python2和python3 不同。安装前请确定需要python2.X 还是python3.X

https://www.python.org/downloads/

2. 安装setuptools

有两种选择; 一种是下载setuptools可执行文件;另一种是推荐方式: 下载ez_setup.py 并在python2.7下执行。将会自动安装setuptools

https://bootstrap.pypa.io/ez_setup.py

windows7 下安装python2.7 setuptools pip_第1张图片



3.安装pip 

  同样的,可以下载pip运行安装, 推荐方式是下载 get-pip.py 执行安装。

https://bootstrap.pypa.io/get-pip.py

windows7 下安装python2.7 setuptools pip_第2张图片

4. pywin

选择对应的版本下载windows可执行文件。双击打开安装。安装过程中需要确认python2.7安装目录。

https://sourceforge.net/projects/pywin32/files/pywin32/



5.  使用pip install 安装软件包时与 lxml相关的错误一:

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -
> build\lib.win-amd64-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  running build_ext
  building 'lxml.etree' extension
  error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Ge
t it from http://aka.ms/vcpython27


  ----------------------------------------
  Failed building wheel for lxml

Running setup.py install for lxml ... error
    Complete output from command f:\python27\python.exe -u -c "import setuptools
, tokenize;__file__='c:\\users\\dhp\\appdata\\local\\temp\\pip-build-7p0xsq\\lxm
l\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('
\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c
:\users\dhp\appdata\local\temp\pip-_tcv73-record\install-record.txt --single-ver
sion-externally-managed --compile:
    Building lxml version 3.7.2.
    Building without Cython.


 按照提示下载 : microsoft visual c++ compiler for python 2.7

http://aka.ms/vcpython27



6. 安装后,再度出现lxml编译错误:

 xmlXPathInitzdquyv.c
   c:\users\dhp\appdata\local\temp\xmlXPathInitzdquyv.c(1) : fatal error C1083:
Cannot open include file: 'libxml/xpath.h': No such file or directory
   ****************************************************************************
****
   Could not find function xmlCheckVersion in library libxml2. Is libxml2 insta
led?
   ****************************************************************************
****
   error: command 'C:\\Users\\dhp\\AppData\\Local\\Programs\\Common\\Microsoft\
Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2


指定安装低版本lxml 解决: 

pip install lxml==3.6.0  


你可能感兴趣的:(AI/machine,learning)