CharesFang / WeiboSpider

微博爬虫,一个基于Scrapy框架的轻量微博爬虫,Sina Weibo Spider
GNU General Public License v3.0
124 stars 25 forks source link

pip install 安装依赖出现报错 #6

Closed Megrax closed 3 years ago

Megrax commented 3 years ago

操作系统:CentOS Linux release 7.9.2009 (Core) Python 环境:

Python 3.8.0 (default, Mar  9 2021, 08:45:15) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux

执行$ pip install -r requirements.txt后中断报如下错误:

Defaulting to user installation because normal site-packages is not writeable
Collecting lxml>=4.6.3
  Using cached lxml-4.6.3-cp38-cp38-manylinux2014_x86_64.whl (6.8 MB)
Collecting fake_useragent==0.1.11
  Using cached fake-useragent-0.1.11.tar.gz (13 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.8 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wg2sl425/fake-useragent_6c3f5aa09e7a40b1a98f53238e8cb447/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wg2sl425/fake-useragent_6c3f5aa09e7a40b1a98f53238e8cb447/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 /tmp/pip-pip-egg-info-x1ra41v3
         cwd: /tmp/pip-install-wg2sl425/fake-useragent_6c3f5aa09e7a40b1a98f53238e8cb447/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 18, in <module>
        from setuptools.dist import Distribution
      File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 32, in <module>
        from setuptools import windows_support
      File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
        import ctypes
      File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
        from _ctypes import Union, Structure, Array
    ModuleNotFoundError: No module named '_ctypes'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/d1/79/af647635d6968e2deb57a208d309f6069d31cb138066d7e821e575112a80/fake-useragent-0.1.11.tar.gz#sha256=c104998b750eb097eefc28ae28e92d66397598d2cf41a31aa45d5559ef1adf35 (from https://pypi.org/simple/fake-useragent/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement fake_useragent==0.1.11 (from versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.1.10, 0.1.11)
ERROR: No matching distribution found for fake_useragent==0.1.11

我对 Python 不太熟,这是不是依赖出了什么问题 //

Megrax commented 3 years ago

问题已经解决了,似乎是我 Python 环境的问题,在重新安装3.7.0版本的 Python 后就正常了。

CharesFang commented 3 years ago

稍后更新Python依赖版本,这个爬虫代码耦合度有点高,最近在忙毕业的事情没有太多时间修改,想进一步交流请email to charesfang@gmail.com