1.安装 Anaconda 或 miniconda
2. 设置conda 国内源
- .condarc文件
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --set show_channel_urls yes
- 更新conda
conda update -n base conda
3. 安装多环境
conda create -n py36 python=3.6
#...\envs\py36
conda create -n py36_tf --clone py36
#...\envs\py36_tf
conda remove -n py_tf10 --all
conda info --envs
4. 激活环境
source activate py36_tf # linux
activate py36_tf # Windows
deactvate # 退出环境
5. pip 国内源
linux: 修改 ~/.pip/pip.conf (没有就创建一个)
windows: 修改 C:\Users\xx\pip\pip.ini
内容如下
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
- 更新 pip
python -m pip install --upgrade pip
pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple # 指定源
6. jupyter 多核
pip install jupyter
#然后注销或重启
activate py36 # 进入环境
pip install ipykernel
python -m ipykernel install --name py36
python -m ipykernel install --user --name 环境名称 --display-name "Python (环境名称)"
7. pip安装
pandas
sklearn
TF
PyTorch官网
PyTorch
python优先的端到端深度学习平台
# 一键升级所有包
import pip
from subprocess import call
from pip._internal.utils.misc import get_installed_distributions
for dist in get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
pip install pandas
pip install pandas_profiling
pip install -U scikit-learn
pip install tensorflow==2.0.0-beta0
pip install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
#pip install torch==1.2.0 torchvision==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html
pip install xgboost
- LightGB官网
前提 :
Git
Cmake
VS2017
OpenCL(CUDA Toolkit)
Boost
git clone --recursive https://github.com/microsoft/LightGBM
cd LightGBM
mkdir _build
cd _build
cmake .. -A x64 -DUSE_GPU=1 -DBOOST_ROOT=C:/_app_/boost -DBOOST_LIBRARYDIR=C:/_app_/boost/lib64-msvc-14.1 -DOpenCL_LIBRARY="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0/lib/x64/OpenCL.lib" -DOpenCL_INCLUDE_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0/include"
#-A x64
#-DUSE_GPU=1
#-DBOOST_ROOT=C:/_app_/boost
#-DBOOST_LIBRARYDIR=C:/_app_/boost/lib64-msvc-14.1
#-DOpenCL_LIBRARY="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0/lib/x64/OpenCL.lib"
#-DOpenCL_INCLUDE_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0/include"
cmake --build . --target ALL_BUILD --config Release
#在release中生成可执行文件lightgbm.exe
# 先激活 想安装到的环境,py36
cd python-package/
python setup.py install --precompile
#log中有这一句:
#copying ..\Release\lib_lightgbm.dll -> C:\_app_\python\Miniconda3\envs\py36\Lib\site-packages\lightgbm