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

pip无法识别"-r"命令:Flask环境搭建安装命令报错求助

解决pip install –r的无效参数错误

Hey there! I see you're new to Flask and ran into a tricky little error when setting up your environment—let's sort this out quickly.

The core issue here is the dash you used in –r: that’s a long em dash (the kind you might accidentally get from copying text or certain keyboard layouts), but pip only recognizes the standard short hyphen (-) for its -r flag. That’s why it’s throwing the "Invalid requirement: '–r'" error—it’s treating –r like a package name instead of a command-line option.

Here’s how to fix this step by step:

  • Re-type the command manually: Skip copying/pasting and type pip install -r requirements.txt directly. Make sure the - before r is the regular hyphen (the same key you use for minus signs on your keyboard).
  • Verify your working directory: Ensure you’re in the same folder where your requirements.txt file lives when you run the command. If not, navigate to that folder with cd /path/to/your/project or use the full file path like pip install -r /path/to/your/project/requirements.txt.
  • Double-check your virtual environment is active: Look at the start of your terminal prompt—you should see your virtual environment’s name (like (venv)). If it’s not active, re-activate it before running the pip command.

Follow these steps, and that error should vanish—pip will correctly read your requirements file and install all the packages you need for your Flask app.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 03:33:10