搭建数据科学环境

搭建数据科学环境

### 本人硬件:cpu i5-9400f ,显卡:rtx 2080ti & gtx960 ,内存 32G 

### 本人系统:Ubuntu 20.04

1.install anaconda

    官网下载anaconda.sh,安装

2.创建data_science环境

conda create --name data_science python=3.8.5

3.Install R & Jupyter(同时嵌入R内核),自己根据地域配镜像提高下载速度

conda activate data_science
conda install r-base=4.0.3
conda install jupyter

运行R 

install.packages('devtools')
devtools::install_github('IRkernel/IRkernel')
IRkernel::installspec()

 

4.安装显卡驱动,cuda,cudnn 

  • 4.1安装显卡驱动:

  • 推荐方法(在图形窗口操作):

    • 打开软件Software & Updates(系统和更新)

    • 点击选项Additional drivers(附加驱动)

    • 选定nvidia driver meta nvidia-460

    • 点击按钮Apply changes(应用更改)

    • ##成功安装后,在终端输入:nvidia-smi 会有结果显示

  • 4.2 安装cuda (https://developer.nvidia.com/cuda-11.2.2-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=2004&target_type=deblocal)

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda-repo-ubuntu2004-11-2-local_11.2.2-460.32.03-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-2-local_11.2.2-460.32.03-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-2-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
  •  为了方便下面深度学习软件的使用,还要把相关路径加入PATH。打开文件~/.profile(若不存在则新建) ,在文档末尾添加以下内容,然后sudo reboot
    # set PATH for cuda 11.2 installation
    if [ -d "/usr/local/cuda-11.2/bin/" ]; then
        export PATH=/usr/local/cuda-11.2/bin${PATH:+:${PATH}}
        export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    fi

    ##安装成功后,在终端输入: nvcc -V 会有结果显示

  • 4.3安装cuDNN,需要在官网注册账号,然后下载三个文件

    • 打开cuDNN官网,点击Download cuDNN v8.1.1 (Feburary 26th, 2021), for CUDA 11.0,11.1 and 11.2

    • 下载以下三个文件:

      • cuDNN Runtime Library for Ubuntu20.04 x86_64 (Deb)

      • cuDNN Developer Library for Ubuntu20.04 x86_64 (Deb)

      • cuDNN Code Samples and User Guide for Ubuntu20.04 x86_64 (Deb)

    • 安装三个deb包:

sudo dpkg -i libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb
sudo dpkg -i libcudnn8-dev_8.1.1.33-1+cuda11.2_amd64.deb
sudo dpkg -i libcudnn8-samples_8.1.1.33-1+cuda11.2_amd64.deb

 ###  此时,已完成显卡部分安装

5.Install tensorflow &  Keras

conda activate data_science
pip install tf-nightly-gpu

 

 

 

 

你可能感兴趣的:(Ubuntu,DeepLearning)