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

Python新手求助:VS Code执行pipenv install --python3.9报错

Fixing Pipenv's ParseException When Running pipenv install --python3.9

Hey there, let's sort out this pipenv mess you're dealing with!

First off, I spot a critical syntax issue in your command: you’re using --python3.9 instead of the correct --python 3.9 (note the space between --python and the version number). When you skip that space, pipenv mistakenly treats --python3.9 as a package name to install—which is why it’s throwing that parsing error, since that’s not a valid package identifier format.

On top of that, all those random install operations from different tutorials probably corrupted your pipenv environment or some core dependency packages. Here’s a step-by-step fix to get things back on track:

  • Clean up the broken environment

    1. If there’s a Pipfile or Pipfile.lock in your project folder, delete them first to start fresh.
    2. Run pipenv --rm to remove the messed-up virtual environment linked to your project.
    3. Clear pipenv’s cache to eliminate any corrupted package files:
      pipenv cache clear
      
  • Fix core Python dependencies

    1. Upgrade your pip to ensure it’s functioning correctly:
      python3.9 -m pip install --upgrade pip
      
    2. Uninstall and reinstall pipenv to refresh it completely:
      pip uninstall -y pipenv
      python3.9 -m pip install pipenv
      
    3. Upgrade setuptools and pyparsing—these are core tools that handle dependency parsing, and they’re likely acting up:
      python3.9 -m pip install --upgrade setuptools pyparsing
      
  • Create a fresh working environment
    Navigate back to your project directory, then run the properly formatted command:

    pipenv install --python 3.9
    

This should resolve the parsing error and get your pipenv environment working again. The combination of the incorrect command syntax and corrupted dependencies from all those tutorial installs was the root cause here.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.11 08:37:30