在startproject生成的Scrapy子文件夹执行scrapy命令提示未识别问题
It sounds like your command prompt can't locate the Scrapy executable because the Anaconda Scripts folder isn't added to your system's PATH environment variable. Here are a few straightforward fixes to resolve this:
1. Use the Anaconda Prompt instead of regular Command Prompt
Anaconda automatically sets up the correct PATH variables when you open its dedicated prompt. Just:
- Open the Anaconda Prompt from your Start Menu
- Navigate to your
quotes_spiderproject folder usingcd path\to\quotes_spider - Run your Scrapy commands normally (e.g.,
scrapy crawl quotes)—this should work without issues.
2. Add the Anaconda Scripts folder to your system PATH
If you prefer using the regular Command Prompt, add the Scrapy executable path to your system's PATH:
- Right-click on This PC (or My Computer) and select Properties
- Click Advanced system settings on the left sidebar
- In the System Properties window, go to the Advanced tab and click Environment Variables
- Under System Variables, find the
Pathvariable and click Edit - Click New and paste the path to your Anaconda Scripts folder:
c:\Users\User\Anaconda3\Scripts - Click OK to save all changes
- Close and reopen your Command Prompt (important—changes won't take effect until you do this)
Now you should be able to runscrapycommands from any directory.
3. Use the full path to the Scrapy executable (temporary fix)
If you don't want to modify your PATH right now, you can run Scrapy using its full path every time:
c:\Users\User\Anaconda3\Scripts\scrapy startproject quotes_spider # Or when inside your project folder: c:\Users\User\Anaconda3\Scripts\scrapy crawl quotes
This works but is less convenient than fixing the PATH long-term.
Quick Check
First, confirm that scrapy.exe actually exists in c:\Users\User\Anaconda3\Scripts. If it's missing, reinstall Scrapy using either:
conda install scrapy(if you're using Anaconda packages)pip install scrapy(make sure you're using the Anaconda pip by runningc:\Users\User\Anaconda3\Scripts\pip install scrapy)
内容的提问来源于stack exchange,提问作者CodePadawan

