You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Python 3.6的Scripts文件夹外创建Scrapy项目?

How to Run Scrapy Commands Outside the Anaconda Scripts Folder

Hey there! I totally get the frustration—when you're used to working within Spyder/Anaconda's GUI, suddenly having to mess with command line paths can feel confusing. Let's break down why you had to navigate to the Scripts folder, and how to fix it so you can create Scrapy projects anywhere you want.

Why This Happened

The core issue is that your system's PATH environment variable doesn't include Anaconda's Scripts directory. When you run a command like scrapy in the console, Windows looks through all the folders listed in PATH to find the executable file (scrapy.exe). Since it wasn't in PATH, you had to go directly to the folder where scrapy.exe lives (the Scripts directory) to run it.

Fix 1: Temporary Solution (Per Session)

If you just want a quick fix for the current console session, you can add the Scripts path to PATH temporarily:

  1. Open Anaconda Prompt like you normally do.
  2. Instead of navigating to the Scripts folder, run this command first:
    set PATH=%PATH%;C:\Users\jecon\Anaconda3\Scripts
    
  3. Now you can navigate to any folder where you want to create your Scrapy project, for example:
    cd "C:\Users\jecon\Documents\MyScrapyProjects"
    
  4. Then run the Scrapy command like normal:
    scrapy startproject tutorial
    

This will only work for that specific console window—you'll have to repeat the PATH command if you open a new one.

Fix 2: Permanent Solution (Set It Once)

For a long-term fix, add the Scripts directory to your system's PATH permanently:

  1. Press Win + R to open the Run dialog, type sysdm.cpl, and hit Enter.
  2. In the System Properties window, go to the Advanced tab and click Environment Variables.
  3. In the "System Variables" section, find the Path variable, select it, and click Edit.
  4. Click New and paste in the full path to your Anaconda Scripts folder:
    C:\Users\jecon\Anaconda3\Scripts
    
  5. Click OK on all open windows to save the changes.
  6. Restart your Anaconda Prompt (or any console you use)—from now on, you can run scrapy commands from any folder on your system.

Bonus: If You Use Anaconda Virtual Environments

If you're working with virtual environments (which is a great practice!), each environment has its own Scripts folder (e.g., C:\Users\jecon\Anaconda3\envs\myenv\Scripts). Instead of adding this to your system PATH, just activate the environment first:

conda activate myenv

Once activated, the environment's Scripts directory is automatically added to your PATH temporarily, so you can run scrapy commands right away without extra steps.

内容的提问来源于stack exchange,提问作者Juan C

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 12:24:14