我正在尝试安装Python模块Scrapy,但找不到requirements.txt文件。我使用的是Python 3.10.4和pip 22.2.2。我试着运行
pip install -r requirements.txt
产生了相同的错误
我在Windows Powershell中键入了以下命令:
pip install scrappy
标准输出:
Collecting scrappy
Using cached Scrappy-0.3.0.alpha.4.tar.gz (17 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting guessit
Using cached guessit-3.4.3-py3-none-any.whl (167 kB)
Collecting tvdb_api
Using cached tvdb_api-3.1.0.tar.gz (23 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Collecting scrappy
Using cached Scrappy-0.3.0.alpha.3.tar.gz (16 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Using cached Scrappy-0.3.0.alpha.2.tar.gz (16 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Using cached Scrappy-0.3.0.alpha.tar.gz (16 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Using cached Scrappy-0.2.10.beta.14.tar.gz (16 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Using cached Scrappy-0.2.10.beta.13.tar.gz (15 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Using cached Scrappy-0.2.10.beta.12.tar.gz (15 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Using cached Scrappy-0.2.10.beta.11.tar.gz (15 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
标准错误:
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:Usersmohm7AppDataLocalTemppip-install-au7_wkmwscrappy_e1f30a064214471db41bbe20fedce6c6setup.py", line 4, in <module>
with open('requirements.txt') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
尝试以下操作:
pip install --ignore-installed scrappy
或者,如果requirements.txt中列出了scrapy(请确保指定了scrappy的版本(,则假设requirements.txt在当前目录中
pip install --ignore-installed -r requirements.txt