使用homebrew安装python3.11

系统自带的版本是3.9,使用homebrew安装3.11版本。

查看可用版本brew search python

安装python3.11brew install python@3.11

Source the .zshrc file: source ~/.zshrc

使用brew list可以看到已经安装了python3.11 (或者使用python3.11)。

使用homebrew安装minicondabrew install --cask miniconda

最近在学习python for data analysis,按照书上的教程to configure conda-forge as your default package channel by running the following commands in a shell:

Conda activate base
(base) $ conda config --add channels conda-forge
(base) $ conda config --set channel_priority strict

Create a new environment (base) $ conda create -y -n pydata python=3.10 (pydata is the name of this environment).

Activate the created environment(base) $ conda activate pydata-book.

Install the essential packages that will be used(pydata-book) $ conda install -y pandas jupyter matplotlib

Upgrade a specific package in a conda environment:

# Activate your environment
conda activate my_env

# Update NumPy
conda update numpy

# Update all packages in the environment
conda update --all

Delete a conda environment and its packages:

Conda deactivate
Conda env remove -n environment_name

To verify that the environment is removed: conda info --envs or conda env list.