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

Win10系统下创建Python3.7.2虚拟环境报错求助

Fixing "non-zero exit status 101" When Creating Python 3.7.2 Virtual Env on Windows 10

Let's work through resolving this error you're hitting when running python -m venv venv. The exit code 101 from ensurepip usually links to path issues, missing Python components, or pip installation failures in your Python 3.7.2 setup. Here are actionable fixes to try:

1. Move Your Project to a Path Without Spaces

Your current working directory has spaces in both "STAR WARE" and "Tricks book" — Windows command line often struggles with spaces when executing nested commands like ensurepip during virtual environment creation.

  • Create a new folder with no spaces, e.g., C:\Users\STARWARE\Documents\Python\TricksBook
  • Move your project files to this new folder, then re-run the venv creation command:
    python -m venv venv
    

2. Create the Virtual Env Without Pip, Then Install Pip Manually

If moving the folder isn't an option, skip the ensurepip step during creation and add pip manually afterward:

  • First, create the virtual environment without pip:
    python -m venv --without-pip venv
    
  • Activate the virtual environment:
    venv\Scripts\activate.bat
    
  • Download the get-pip.py script (you can obtain this from the official Python distribution resources), then run it inside the activated environment:
    python get-pip.py
    

3. Reinstall Python 3.7.2 with Full Components

It's possible your Python 3.7.2 installation is missing the ensurepip module or core pip components:

  • Uninstall Python 3.7.2 from your Windows Control Panel
  • Download the official Python 3.7.2 installer again
  • Run the installer, and make sure to:
    • Check the box "Add Python 3.7 to PATH"
    • Select "Customize Installation" and ensure "pip" is checked under Optional Features
    • Complete the installation, then try creating the virtual environment again with admin privileges

Why This Happens

The error occurs because the ensurepip subcommand (which venv runs automatically to set up pip) fails to execute properly. Common triggers on Windows 10 with Python 3.7 include:

  • Spaces in the project path causing command parsing errors
  • Missing or corrupted ensurepip files in your Python installation
  • Network issues preventing ensurepip from downloading the latest pip packages

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.12 04:33:56