自用,看心情更新~
Python环境配置
- Python下载地址:https://www.python.org/
- VS Code下载地址:https://code.visualstudio.com/Download
- Pycharm下载地址:https://www.jetbrains.com/pycharm/download
- Conda 下载地址:
- 官网:
- Anaconda: https://www.anaconda.com/download
- miniconda: https://docs.anaconda.com/free/miniconda/
- 国内镜像:
- 官网:
P.S. Conda和Python安装文件记得保留,卸载异常的时候会用到!!!
Cheatsheet
conda create -n py312 python=3.12 numpy pandas matplotlib seaborn scikit-learn scipy prettytable beautifulsoup4 jupyterlab
conda remove -n py312 --all
conda clean --all -y
基础配置
此处略过以下内容:
- Python安装
- Python环境的配置:添加路径
...Python\Python312
,...Python\Python312\Scripts
到环境变量 - IDE安装:VS Code 或 Pycharm(需激活)
- Anaconda 或 Miniconda 的安装
- Anaconda环境的配置:添加路径
...Anaconda3
,...Anaconda3\Scripts
,...Anaconda3\Library\bin
到环境变量 - Miniconda环境的配置:添加路径
...miniconda3
,...miniconda3\Scripts
,...miniconda3\Library\bin
,...miniconda3\Library\usr\bin
,...miniconda3\Library\mingw-w64\bin
到环境变量
- Anaconda环境的配置:添加路径
- conda自定义配置文件:虚拟环境路径、Channel国内换源等
环境搭建
# 安装和卸载
conda crete -n venv_name python=version [packages]
conda (env) remove -n venv_name --all
# 环境切换
conda activate venv_name
source activate path/venv_name
python --version
deactivate
# 环境
conda env create -f environment.yml
conda env export > environment.yml
conda env create -f environment.yml
# ---
conda list -e > requirements.txt
conda install -f requirements.txt
# ---
pip freeze > requirements.txt
pip install -r requirements.txt
常用命令
# 包安装
# conda=1.0 pip==1.0
conda/ pip install numpy pandas matplotlib seaborn scipy jupyter notebook graphviz pycallgraph2
pip install --target path/[package]
conda update [package]
pip install --upgrade [package]
conda/pip uninstall [package]
conda remove [package]
pip uninstall --dry-run [package] # 清理未使用的包
# 包清理
conda clean
pip clean
# 查看
conda list
pip list
pip list --dependencies # 查看依赖项
R环境配置
R-base&Rtools下载地址:https://mirrors.tuna.tsinghua.edu.cn/CRAN/
RStudio下载地址:https://www.rstudio.com/products/rstudio/
基础配置
此处略过以下内容:
- R-base和Rtools安装
- R环境的配置:添加路径
...R\R-4.3.3\bin\x64
到环境变量 - IDE安装:RStudio
- RStudio global optionn配置
环境搭建
install.package("[package_name]")
libPaths()
直接备份library路径