深度学习库安装填坑

1.tensorflow2.3版本安装

用pip 和 conda 都失败,怎么办?——>下载miniconda3.5-3.7版本。
地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/,然后采用miniconda中的conda 或 pip命令安装即可。亲测成功!
cpu版本的tensorflow安装:
pip install tensorflow==2.3.0 -i https://pypi.douban.com/simple/

gpu版本的tensorflow安装:
对于NVIDIA显卡,要求其CUDA Compute Capability 须不低于3.5
驱动版本注意:NVIDIA驱动程序需要418.x或更高版本。

(base) E:\miniconda\Scripts>nvidia-smi
Sun Dec 13 18:48:59 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 442.94       ***Driver Version: 442.94***       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce MX330      WDDM  | 00000000:02:00.0 Off |                  N/A |
| N/A   35C    P8    N/A /  N/A |     64MiB /  2048MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

conda install cudatoolkit=10.1 (必须是10.1版本的!)
conda install cudnn=7.6.5
pip install tensorflow-gpu==2.3.0 -i https://pypi.douban.com/simple/

#验证tensorflow GPU版本是否安装成功
import tensorflow as tf
print(tf.version)

>>>tf.test.is_gpu_available()
WARNING:tensorflow:From <stdin>:1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2020-12-13 18:38:27.767425: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-12-13 18:38:27.788709: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x221fd15a7b0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-12-13 18:38:27.791532: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-12-13 18:38:27.794410: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2020-12-13 18:38:28.445338: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:02:00.0 name: GeForce MX330 computeCapability: 6.1
coreClock: 1.594GHz coreCount: 3 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 52.21GiB/s
2020-12-13 18:38:28.457512: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2020-12-13 18:38:28.467292: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cublas64_10.dll
2020-12-13 18:38:28.476814: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cufft64_10.dll
2020-12-13 18:38:28.481381: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library curand64_10.dll
2020-12-13 18:38:28.491603: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusolver64_10.dll
2020-12-13 18:38:28.498800: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusparse64_10.dll
2020-12-13 18:38:28.518331: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudnn64_7.dll
2020-12-13 18:38:28.520767: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2020-12-13 18:38:29.221042: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-12-13 18:38:29.227503: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]      0
2020-12-13 18:38:29.228743: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1276] 0:   N
2020-12-13 18:38:29.232177: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/device:GPU:0 with 1342 MB memory) -> physical GPU (device: 0, name: GeForce MX330, pci bus id: 0000:02:00.0, compute capability: 6.1)
2020-12-13 18:38:29.240825: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x221a35d9c30 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-12-13 18:38:29.243497: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): GeForce MX330, Compute Capability 6.1

#打开notebook的方法

(base) E:\miniconda\Scripts>ipython notebook

检查GPU版本的tensorflow或torch是否安装成功

tf.test.is_gpu_available() #tensorflow
torch.cuda.is_available()  #torch

关于fasttext 0.8.3版本安装的巨坑~

Windows平台需要安装的是fasttext_win==0.8.3版本的包,且必须安装visual c++插件才能正常使用。
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值