ServBay Pip Usage Guide
What is pip?
pip is the official package management tool for Python. It is the cornerstone of the Python ecosystem and has the following features:
Development History:
- First released in 2008 as a replacement for the earlier easy_install
- Included by default in Python installations since Python 3.4
- The latest stable version is the pip 23.x series
Core Features:
- Downloads and installs packages from PyPI (Python Package Index)
- Manages project dependencies
- Handles package version conflicts
- Supports installation from version control systems, local projects, or distribution files
Integration with ServBay:
- ServBay comes pre-installed with the latest stable version of pip
- Works automatically with configured mirror sources
- Supports pip management for all Python versions
Tips for Using pip
ServBay has pip pre-installed, so you can use it directly:
Basic Commands
bash
# Install a package
pip install package_name
# Upgrade a package
pip install --upgrade package_name
# Uninstall a package
pip uninstall package_name
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Advanced Usage
bash
# List installed packages
pip list
# Generate a requirements file
pip freeze > requirements.txt
# Install from requirements file
pip install -r requirements.txt
# Install specifying a mirror source (temporarily override settings)
pip install package_name -i https://pypi.tuna.tsinghua.edu.cn/simple
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Using Virtual Environments
bash
# Create a virtual environment
python -m venv myenv
# Activate the virtual environment
source myenv/bin/activate # Linux/Mac
myenv\Scripts\activate # Windows
# Use pip within the virtual environment
pip install package_name
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Best Practice Recommendations
- It is recommended to use a virtual environment to isolate dependencies when developing projects.
- For large projects, manage dependencies with a
requirements.txt
file. - If you encounter download issues, try switching to different mirror sources.
- Regularly use
pip list --outdated
to check for packages that can be updated.
The configuration of ServBay's PyPI mirror, combined with the built-in pip tool, provides a complete and efficient package management solution for Python development.