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

Windows系统下从源码安装Python3的Spacy时执行export命令报错

Fixing the export Error When Installing spaCy from Source on Windows

Hey there! Let's sort out that export command error you're facing while installing spaCy from source on Windows. The problem is straightforward: export is a command for Linux/Mac shells, but Windows Command Prompt and PowerShell use their own syntax for environment variables. Here's a step-by-step solution:

1. Find Your pwd Equivalent Path

First, you need the full path to your spaCy source code directory (this is what pwd returns on Unix systems):

  • In Command Prompt: Run cd without any arguments to see your current directory path, or just check the top bar of the Command Prompt window.
  • In PowerShell: Run pwd directly—it will output the full absolute path to your current working directory. Copy this path (it should be the folder where you cloned or extracted spaCy's source code, which contains the setup.py file).

2. Set PYTHONPATH Temporarily (For Current Session Only)

Replace the Unix-style export PYTHONPATH=pwd command with the Windows-specific version:

  • For Command Prompt:
    set PYTHONPATH=C:\full\path\to\your\spacy\source
    
    Replace C:\full\path\to\your\spacy\source with the actual path you copied in step 1.
  • For PowerShell:
    $env:PYTHONPATH = "C:\full\path\to\your\spacy\source"
    

3. Set PYTHONPATH Permanently (Persists Across Sessions)

If you want this path to be available every time you open a terminal or IDE:

  • Right-click "This PC" → Select "Properties" → Click "Advanced system settings" → Open the "Environment Variables" window.
  • Under "User variables" (for your account only) or "System variables" (for all users), click "New".
    • Variable name: PYTHONPATH
    • Variable value: Paste the full path to your spaCy source directory (e.g., C:\Users\jax\spacy)
  • Click "OK" to save all changes, then restart your terminal or IDE for the setting to take effect.

4. Verify the Setup Worked

To make sure Python can find your spaCy source code:
Open a Python shell or your IDE and run:

import sys
print(sys.path)

Check if your spaCy source directory path appears in the output. If it does, you're good to go with the remaining installation steps (like pip install -e .).

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 09:34:19