structure updates
This commit is contained in:
70
tech_docs/python/python_mac.md
Normal file
70
tech_docs/python/python_mac.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Installing Python 3 on macOS with Homebrew
|
||||
|
||||
This guide provides a concise overview of installing Python 3 on an M2 MacBook Air using Homebrew, and setting up `pip` and `venv` for a robust Python development environment.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Access to Terminal
|
||||
- Connectivity to the Internet
|
||||
|
||||
## Step 1: Install Homebrew
|
||||
|
||||
Open Terminal and run:
|
||||
|
||||
```sh
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
```
|
||||
|
||||
## Step 2: Install Python 3
|
||||
|
||||
Install Python 3, which includes `pip3` and `venv`, by running:
|
||||
|
||||
```sh
|
||||
brew install python
|
||||
```
|
||||
|
||||
## Step 3: Verify Python 3 Installation
|
||||
|
||||
Check the Python version to verify installation:
|
||||
|
||||
```sh
|
||||
python3 --version
|
||||
```
|
||||
|
||||
## Step 4: Verify pip Installation
|
||||
|
||||
Ensure `pip3` is installed:
|
||||
|
||||
```sh
|
||||
pip3 --version
|
||||
```
|
||||
|
||||
## Step 5: Setup Virtual Environments with venv
|
||||
|
||||
Navigate to your project directory:
|
||||
|
||||
```sh
|
||||
cd path/to/your/project
|
||||
```
|
||||
|
||||
Create a virtual environment:
|
||||
|
||||
```sh
|
||||
python3 -m venv venv
|
||||
```
|
||||
|
||||
Activate the virtual environment:
|
||||
|
||||
```sh
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
## Step 6: Deactivate Virtual Environment
|
||||
|
||||
To exit the virtual environment:
|
||||
|
||||
```sh
|
||||
deactivate
|
||||
```
|
||||
|
||||
This guide ensures you have a functional Python environment on macOS, ideal for development activities.
|
||||
Reference in New Issue
Block a user