解决 Pyspider 在 Windows 系统上安装报错的问题

Posted Xavier Jiezou

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决 Pyspider 在 Windows 系统上安装报错的问题相关的知识,希望对你有一定的参考价值。

问题描述

Pyspider 在 Windows 系统上直接通过 pip install pyspider 安装报错:

 ERROR: Command errored out with exit status 10:
     command: 'C:\\ProgramData\\Miniconda3\\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\\\Users\\\\87897\\\\AppData\\\\Local\\\\Temp\\\\pip-install-xihyzbcc\\\\pycurl_82ca8aa9b71a43bd9399542f724d2655\\\\setup.py'"'"'; __file__='"'"'C:\\\\Users\\\\87897\\\\AppData\\\\Local\\\\Temp\\\\pip-install-xihyzbcc\\\\pycurl_82ca8aa9b71a43bd9399542f724d2655\\\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\\r\\n'"'"', '"'"'\\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\\Users\\87897\\AppData\\Local\\Temp\\pip-pip-egg-info-8uato2i0'
         cwd: C:\\Users\\87897\\AppData\\Local\\Temp\\pip-install-xihyzbcc\\pycurl_82ca8aa9b71a43bd9399542f724d2655\\
    Complete output (5 lines):
    C:\\Users\\87897\\AppData\\Local\\Temp\\pip-install-xihyzbcc\\pycurl_82ca8aa9b71a43bd9399542f724d2655\\setup.py:957: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      if LooseVersion(distutils.__version__) > LooseVersion("1.0.1"):
    C:\\Users\\87897\\AppData\\Local\\Temp\\pip-install-xihyzbcc\\pycurl_82ca8aa9b71a43bd9399542f724d2655\\setup.py:959: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
      if LooseVersion(distutils.__version__) < LooseVersion("1.0.3"):
    Please specify --curl-dir=/path/to/built/libcurl
ERROR: Cannot install pyspider==0.3.0, pyspider==0.3.1, pyspider==0.3.10, pyspider==0.3.2, pyspider==0.3.3, pyspider==0.3.4, pyspider==0.3.5, pyspider==0.3.6, pyspider==0.3.7, pyspider==0.3.8 and pyspider==0.3.9 because these package versions have conflicting dependencies.

The conflict is caused by:
    pyspider 0.3.10 depends on pycurl
    pyspider 0.3.9 depends on pycurl
    pyspider 0.3.8 depends on pycurl
    pyspider 0.3.7 depends on pycurl
    pyspider 0.3.6 depends on pycurl
    pyspider 0.3.5 depends on pycurl
    pyspider 0.3.4 depends on pycurl
    pyspider 0.3.3 depends on pycurl
    pyspider 0.3.2 depends on pycurl
    pyspider 0.3.1 depends on pycurl>=7.19
    pyspider 0.3.0 depends on pycurl>=7.19

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

解决方案

先安装 pycurl,从这里下载编译好的版本

  • 7.45.1:版本号
  • cp39:适用于 Python 3.9
  • win_amd64:Windows 64 位操作系统
  • win32:Windows 32 位操作系统

下载完成后,通过 pip install 安装

pip install pycurl‑7.45.1‑cp39‑cp39‑win_amd64.whl

最后,使用 pip install 直接安装 pyspider 就不会报错了

pip install spider

以上是关于解决 Pyspider 在 Windows 系统上安装报错的问题的主要内容,如果未能解决你的问题,请参考以下文章

pyspider 在ubuntu上安装失败怎么搞?

Windows部署pyspider指南

windows环境安装phantomjs和pyspider遇到的问题

Pyspider的基本使用 -- 入门

pyspider初次使用pyspider遇到的问题

PySpider的安装