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

如何为Python 3.6.0安装包/模块?新手求助操作疑问

Hey there! Let's break down your problems step by step—since you're new to Python, these are super common hurdles, so don't worry 😊

1. Missing the scripts Folder

The scripts folder is part of a standard Python installation; it holds essential tools like pip (the package installer you'll rely on constantly). If you don't have it, here's what's likely going on and how to fix it:

  • You skipped adding Python to your system PATH during installation: On Windows, this is a easy-to-miss checkbox in the installer. On Mac/Linux, the installer usually handles this automatically, but custom installations sometimes skip this step.
  • Your Python install is incomplete: Maybe you chose a minimal installation that excluded the scripts directory entirely.

Fixes:

  • Reinstall Python (recommended for beginners): Grab the latest version from the official Python site, and make sure to check the box labeled "Add Python to PATH" (Windows) or follow prompts to include all standard components. This will create the scripts folder automatically.
  • Manually add Python to your system PATH: If you don't want to reinstall, find your Python installation directory (e.g., C:\Python311 on Windows, /usr/local/bin/python3 on Mac/Linux). Add this directory (and the scripts subfolder if it exists elsewhere) to your system's PATH environment variable. This lets your terminal locate pip and other Python tools.
2. Using requirements.txt Correctly

Let's clear up the confusion around this file:

What is requirements.txt?

It's a plain text file where you list all the Python packages your project needs, often with specific version numbers (optional but recommended for consistency). For example:

requests==2.31.0
numpy==1.25.2
pandas==2.1.0

Where to put it?

Place it directly in the root folder of your Python project. If you're working on a project called my_first_project, save requirements.txt inside that folder—this keeps all your project files organized and easy to manage.

Where to run the command?

You'll need to use your terminal (Command Prompt/PowerShell on Windows, Terminal app on Mac/Linux) and first navigate to the folder where requirements.txt is stored. Here's how:

  1. Open your terminal application.
  2. Use the cd command to switch to your project folder. For example:
    • Windows: cd C:\Users\YourName\my_first_project
    • Mac/Linux: cd ~/my_first_project
  3. Once you're in the correct folder, run the command:
    pip3 install -r requirements.txt
    
    • If pip3 doesn't work, try python -m pip install -r requirements.txt instead—this ensures you're using the pip tied to your current Python installation, avoiding path-related errors.

Quick Pre-Check:

Before running the install command, confirm Python and pip are working by typing these in your terminal:

  • python3 --version (or python --version on Windows)
  • pip3 --version (or pip --version)
    If these commands show a valid version number, you're ready to go!

内容的提问来源于stack exchange,提问作者Philip Svenningsen Arnevig

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.22 09:00:25