我正在运行 Arch Linux 并且我已经更新了软件包。
我有asdf
管理运行时间和 sdks 等。
在我的项目的根目录中,我有一个.tool-versions
文件:
~/code/bejebeje-bot main !1 ?1 ❯ \cat .tool-versions 3.10.2
python 3.10.2
然后我就这么做了asdf reshim python
。然后我想scrapy
通过安装 python 包pip
,我得到了这个:
~/code/bejebeje-bot main !1 ?1 ❯ pip install scrapy 3.10.2
Requirement already satisfied: scrapy in /home/j/.local/lib/python3.10/site-packages (2.6.1)
Requirement already satisfied: pyOpenSSL>=16.2.0 in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from scrapy) (22.0.0)
Requirement already satisfied: cryptography>=2.0 in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from scrapy) (36.0.1)
Requirement already satisfied: protego>=0.1.15 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (0.2.1)
Requirement already satisfied: w3lib>=1.17.0 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (1.22.0)
Requirement already satisfied: itemloaders>=1.0.1 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (1.0.4)
Requirement already satisfied: zope.interface>=4.1.3 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (5.4.0)
Requirement already satisfied: setuptools in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from scrapy) (58.1.0)
Requirement already satisfied: service-identity>=16.0.0 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (21.1.0)
Requirement already satisfied: cssselect>=0.9.1 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (1.1.0)
Requirement already satisfied: lxml>=3.5.0 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (4.8.0)
Requirement already satisfied: PyDispatcher>=2.0.5 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (2.0.5)
Requirement already satisfied: itemadapter>=0.1.0 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (0.4.0)
Requirement already satisfied: tldextract in /home/j/.local/lib/python3.10/site-packages (from scrapy) (3.2.0)
Requirement already satisfied: queuelib>=1.4.2 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (1.6.2)
Requirement already satisfied: Twisted>=17.9.0 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (22.2.0)
Requirement already satisfied: parsel>=1.5.0 in /home/j/.local/lib/python3.10/site-packages (from scrapy) (1.6.0)
Requirement already satisfied: cffi>=1.12 in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from cryptography>=2.0->scrapy) (1.15.0)
Requirement already satisfied: jmespath>=0.9.5 in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from itemloaders>=1.0.1->scrapy) (0.10.0)
Requirement already satisfied: six>=1.6.0 in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from parsel>=1.5.0->scrapy) (1.16.0)
Requirement already satisfied: pyasn1-modules in /home/j/.local/lib/python3.10/site-packages (from service-identity>=16.0.0->scrapy) (0.2.8)
Requirement already satisfied: pyasn1 in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from service-identity>=16.0.0->scrapy) (0.4.8)
Requirement already satisfied: attrs>=19.1.0 in /home/j/.local/lib/python3.10/site-packages (from service-identity>=16.0.0->scrapy) (21.4.0)
Requirement already satisfied: Automat>=0.8.0 in /home/j/.local/lib/python3.10/site-packages (from Twisted>=17.9.0->scrapy) (20.2.0)
Requirement already satisfied: typing-extensions>=3.6.5 in /home/j/.local/lib/python3.10/site-packages (from Twisted>=17.9.0->scrapy) (4.1.1)
Requirement already satisfied: incremental>=21.3.0 in /home/j/.local/lib/python3.10/site-packages (from Twisted>=17.9.0->scrapy) (21.3.0)
Requirement already satisfied: constantly>=15.1 in /home/j/.local/lib/python3.10/site-packages (from Twisted>=17.9.0->scrapy) (15.1.0)
Requirement already satisfied: hyperlink>=17.1.1 in /home/j/.local/lib/python3.10/site-packages (from Twisted>=17.9.0->scrapy) (21.0.0)
Requirement already satisfied: requests>=2.1.0 in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from tldextract->scrapy) (2.27.1)
Requirement already satisfied: idna in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from tldextract->scrapy) (3.3)
Requirement already satisfied: requests-file>=1.4 in /home/j/.local/lib/python3.10/site-packages (from tldextract->scrapy) (1.5.1)
Requirement already satisfied: filelock>=3.0.8 in /home/j/.local/lib/python3.10/site-packages (from tldextract->scrapy) (3.6.0)
Requirement already satisfied: pycparser in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from cffi>=1.12->cryptography>=2.0->scrapy) (2.21)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from requests>=2.1.0->tldextract->scrapy) (1.26.8)
Requirement already satisfied: charset-normalizer~=2.0.0 in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from requests>=2.1.0->tldextract->scrapy) (2.0.12)
Requirement already satisfied: certifi>=2017.4.17 in /home/j/.asdf/installs/python/3.10.2/lib/python3.10/site-packages (from requests>=2.1.0->tldextract->scrapy) (2021.10.8)
当我跑步时,pip list
我可以看到它Scrapy
确实存在!
~/code/bejebeje-bot main !1 ?1 ❯ pip list 3.10.2
Package Version
------------------ ---------
attrs 21.4.0
Automat 20.2.0
certifi 2021.10.8
cffi 1.15.0
charset-normalizer 2.0.12
constantly 15.1.0
cryptography 36.0.1
cssselect 1.1.0
filelock 3.6.0
hyperlink 21.0.0
idna 3.3
incremental 21.3.0
itemadapter 0.4.0
itemloaders 1.0.4
jmespath 0.10.0
lxml 4.8.0
parsel 1.6.0
pip 22.0.4
pipx 1.0.0
Protego 0.2.1
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.21
PyDispatcher 2.0.5
pyOpenSSL 22.0.0
queuelib 1.6.2
requests 2.27.1
requests-file 1.5.1
Scrapy 2.6.1
service-identity 21.1.0
setuptools 58.1.0
six 1.16.0
tldextract 3.2.0
Twisted 22.2.0
typing_extensions 4.1.1
urllib3 1.26.8
userpath 1.7.0
w3lib 1.22.0
zope.interface 5.4.0
然而,该scrapy
命令未被识别,当我尝试运行我的蜘蛛时,我得到:
~/code/bejebeje-bot/gsscraper main !1 ?1 ❯ scrapy crawl gsspider -o stran.json 3.10.2
zsh: command not found: scrapy
如果我运行asdf current
我会得到:
~/code/bejebeje-bot main !1 ?1 ❯ asdf current 3.10.2
nodejs ______ No version is set. Run "asdf <global|shell|local> nodejs <version>"
python 3.10.2 /home/j/code/bejebeje-bot/.tool-versions
我在这里做错了什么?为什么我不能跑scrapy
?我很困惑。
附言。我想添加asdf
标签,但我的积分还不够。
更新
我跑了pip show scrapy
,得到:
~/code/bejebeje-bot main !1 ?1 ❯ pip show scrapy 3.10.2
Name: Scrapy
Version: 2.6.1
Summary: A high-level Web Crawling and Web Scraping framework
Home-page: https://scrapy.org
Author: Scrapy developers
Author-email:
License: BSD
Location: /home/j/.local/lib/python3.10/site-packages
Requires: cryptography, cssselect, itemadapter, itemloaders, lxml, parsel, protego, PyDispatcher, pyOpenSSL, queuelib, service-identity, setuptools, tldextract, Twisted, w3lib, zope.interface
Required-by:
我觉得这个位置应该在下面的某个地方/home/j/.asdf/shims/
!我的$PATH
有以下内容:
~/code/bejebeje-bot main !1 ?1 ❯ sed 's/:/\n/g' <<< "$PATH" 3.10.2
/home/j/.asdf/shims
/opt/asdf-vm/bin
/usr/local/sbin
/usr/local/bin
/usr/bin
/usr/local/go/bin
/home/j/code/go/bin
/home/j/.dotnet/tools
/usr/lib/jvm/default/bin
/usr/bin/site_perl
/usr/bin/vendor_perl
/usr/bin/core_perl
/usr/local/go/bin
/home/j/code/go/bin
/usr/local/go/bin
/home/j/code/go/bin
/home/j/.dotnet
/home/j/.dotnet/tools
~/programs/JetBrains Rider-2021.3.3/bin