python 运行环境

1.安装 Anaconda 或 miniconda

官网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 (环境名称)"

jupyter快捷方式

选择启动

7. pip安装

pandas
sklearn
TF
PyTorch官网
PyTorch
python优先的端到端深度学习平台

xgboost官网

# 一键升级所有包
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值