无法在Windows上安装Python Scrapy(Lxml)

时间:2015-05-07 17:25:28

标签: python windows scrapy lxml

我尝试安装 Python Scrapy库但是当它尝试安装 Lxml 库时,会出现此错误:

Requirement already up-to-date: pip in c:\python34\lib\site-packages
Collecting lxml
  Using cached lxml-3.4.4.tar.gz
    Complete output from command python setup.py egg_info:
    Building lxml version 3.4.4.
    Building without Cython.
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "C:\Users\ALEJAN~1\AppData\Local\Temp\pip-build-b8ysz_w_\lxml\setup.py", line 230, in <module>
        **setup_extra_options()
      File "C:\Users\ALEJAN~1\AppData\Local\Temp\pip-build-b8ysz_w_\lxml\setup.py", line 144, in setup_extra_options
        STATIC_CFLAGS, STATIC_BINARIES)
      File "C:\Users\ALEJAN~1\AppData\Local\Temp\pip-build-b8ysz_w_\lxml\setupinfo.py", line 90, in ext_modules
        lib_versions = get_library_versions()
      File "C:\Users\ALEJAN~1\AppData\Local\Temp\pip-build-b8ysz_w_\lxml\setupinfo.py", line 308, in get_library_version
s
        xslt_version = run_command(find_xslt_config(), "--version")
      File "C:\Users\ALEJAN~1\AppData\Local\Temp\pip-build-b8ysz_w_\lxml\setupinfo.py", line 283, in run_command
        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      File "C:\Python34\lib\subprocess.py", line 858, in __init__
        restore_signals, start_new_session)
      File "C:\Python34\lib\subprocess.py", line 1111, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in C:\Users\ALEJAN~1\AppData\Local\Temp\pip-build-b8ysz_
w_\lxml

我正在检查目录,但一切似乎都没问题。其他库安装没有错误。

我该怎么办?

我尝试安装Lxml,但是Python在这个平台上显示它不支持。

3 个答案:

答案 0 :(得分:0)

很抱歉通知您,但Scrapy不支持Python3.4。

我有这个确切的问题,并一直在努力解决为什么它不起作用。事实上还没有从2.7到3.4的Scrapy端口。如果你有2.7

,你可以使用Scrapy

您有两个选择:重写您的代码以在Python 2.7上运行或使用BeautifulSoup,这是一个兼容Python 3.4的python中的Web scraper

答案 1 :(得分:0)

我试图整天修复错误,但我无法找到确切的解决方案。我最后再次卸载并安装Python(2.7.9)并添加到路径C:\Python27\Scripts(除了C:\Python27\之外,它一直在那里)。现在它有效!仍然不知道这是否是导致错误的原因。

答案 2 :(得分:0)

  1. 安装Anaconda Python发布。它预装了lxlm。
  2. 打开cmd并输入:
  3.   

    conda install scrapy

    Conda是Anaconda的包经理,如pip。