问题出现
pip3 install scrapy
[root@CentOS-s-1-CPU-1-GB ~]# pip3 install scrapy
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting scrapy
Downloading https://mirrors.aliyun.com/pypi/packages/e2/8a/e3870cd597bbd4f47d7e1c97bbb67a6293270b9c413e083058ce6d6c7eb7/Scrapy-2.6.2-py2.py3-none-any.whl (264kB)
100% |????????????????????????????????| 266kB 294kB/s
Collecting pyOpenSSL>=16.2.0 (from scrapy)
Downloading https://mirrors.aliyun.com/pypi/packages/d5/9f/9c0e3288b85f907a008f9d31318b0e4de31b2f67724a8745e633741f609c/pyOpenSSL-22.0.0-py2.py3-none-any.whl (55kB)
100% |????????????????????????????????| 61kB 333kB/s
Collecting zope.interface>=4.1.3 (from scrapy)
Downloading https://mirrors.aliyun.com/pypi/packages/67/67/8178e511cd4f0a481082aac1c0e2d64c520a5ee92ea8ce42d8297a4fca7e/zope.interface-5.4.0-cp36-cp36m-manylinux1_x86_64.whl (251kB)
100% |????????????????????????????????| 256kB 303kB/s
Collecting lxml>=3.5.0; platform_python_implementation == "CPython" (from scrapy)
Downloading https://mirrors.aliyun.com/pypi/packages/0f/4e/e139648475c0eb42cdb813461ae11f567e1888a20d7dfd5256f47e32909d/lxml-4.9.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (5.6MB)
100% |????????????????????????????????| 5.6MB 307kB/s
Collecting parsel>=1.5.0 (from scrapy)
Downloading https://mirrors.aliyun.com/pypi/packages/23/1e/9b39d64cbab79d4362cdd7be7f5e9623d45c4a53b3f7522cd8210df52d8e/parsel-1.6.0-py2.py3-none-any.whl
Collecting protego>=0.1.15 (from scrapy)
Downloading https://mirrors.aliyun.com/pypi/packages/81/4d/3e01f10d6dd2d35793711c2e27a07e547c6aec0ab8d3199bb83e68956fdb/Protego-0.2.1-py2.py3-none-any.whl
Collecting cryptography>=2.0 (from scrapy)
Downloading https://mirrors.aliyun.com/pypi/packages/89/d9/5fcd312d5cce0b4d7ee8b551a0ea99e4ea9db0fdbf6dd455a19042e3370b/cryptography-37.0.4.tar.gz (585kB)
100% |????????????????????????????????| 593kB 330kB/s
Complete output from command python setup.py egg_info:
=============================DEBUG ASSISTANCE==========================
If you are seeing an error here please try the following to
successfully install cryptography:
Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
=============================DEBUG ASSISTANCE==========================
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-dgfowu9k/cryptography/setup.py", line 14, in <module>
from setuptools_rust import RustExtension
ModuleNotFoundError: No module named 'setuptools_rust'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dgfowu9k/cryptography/
解决方案
pip3 install --upgrade --force pip
[root@CentOS-s-1-CPU-1-GB ~]# pip3 install --upgrade --force pip
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting pip
Downloading https://mirrors.aliyun.com/pypi/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7MB)
100% |????????????????????????????????| 1.7MB 330kB/s
Installing collected packages: pip
Successfully installed pip-21.3.1
解决后展示再次安装成功
[root@CentOS-s-1-CPU-1-GB ~]# scrapy -h
/usr/local/lib/python3.6/site-packages/OpenSSL/crypto.py:8: CryptographyDeprecationWarning: Pported by the Python core team. Therefore, support for it is deprecated in cryptography and w release.
from cryptography import utils, x509
Scrapy 2.6.2 - no active project
Usage:
scrapy <command> [options] [args]
Available commands:
bench Run quick benchmark test
commands
fetch Fetch a URL using the Scrapy downloader
genspider Generate new spider using pre-defined templates
runspider Run a self-contained spider (without creating a project)
settings Get settings values
shell Interactive scraping console
startproject Create new project
version Print Scrapy version
view Open URL in browser, as seen by Scrapy
[ more ] More commands available when run from project directory
Use "scrapy <command> -h" to see more info about a command