1. Ubuntu下使用pip方式安装tensorflow
参考文档: https://tensorflow.google.cn/install/pip
首先明确,我们采用python3环境。
1. 先确认本机已安装好python3的环境
python3 --version
pip3 --version
virtualenv --version
如没有则安装以下命令安装:
$ sudo apt-get install python3-pip python3-dev
$ sudo pip3 install -U virtualenv
2. 创建虚拟环境(推荐)
Python虚拟环境用于将包安装与系统隔离。
# 通过选择Python解释器并创建./venv目录来保存一个新的虚拟环境:
$ virtualenv --system-site-packages -p python3 ./venv
# 使用特定的shell命令激活虚拟环境:
$ source ./venv/bin/activate # sh, bash, ksh, or zsh
# 当virtualenv激活时,你的shell提示符有(venv)前缀
# 在虚拟的环境中安装包不会影响主机系统的配置。首先升级pip:
(venv) $ pip install --upgrade pip
(venv) $ pip list
# 然后可以退出虚拟环境:
(venv) $ deactivate # don't exit until you're done using TensorFlow
3. 安装TensorFlow pip包
从PyPI安装以下一个TensorFlow软件包:
- tensorflow —Current release for CPU-only (recommended for beginners)
- tensorflow-gpu —Current release with GPU support(Ubuntu and Windows)
- tf-nightly —Nightly build for CPU-only (unstable)
- tf-nightly-gpu —Nightly build with GPU support (unstable, Ubuntu and Windows)
如果是要安装GPU版本,需要做一些额外的设置:
# 对于Ubuntu 16.04和可能的其他基于Debian的Linux Distros添加NVIDIA包存储库,并使用APT安装CUDA。
# Add NVIDIA package repository
$ sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
$ wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
$ sudo apt install ./cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
$ wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
$ sudo apt install ./nvidia-machine-learning-repo-ubuntu1604_1.0.0-1_amd64.deb
$ sudo apt update
# Install CUDA and tools. Include optional NCCL 2.x
$ sudo apt install cuda9.0 cuda-cublas-9-0 cuda-cufft-9-0 cuda-curand-9-0 \
cuda-cusolver-9-0 cuda-cusparse-9-0 libcudnn7=7.2.1.38-1+cuda9.0 \
libnccl2=2.2.13-1+cuda9.0 cuda-command-line-tools-9-0
# Optional: Install the TensorRT runtime (must be after CUDA install)
$ sudo apt update
$ sudo apt install libnvinfer4=4.1.2-1+cuda9.0
虚拟环境安装:
(venv) $ pip install --upgrade tensorflow # 可能时间会比较长,如果要支持GPU,请安装tensorflow-gpu
# 验证安装:
(venv) $ python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
安装成功后,就可以开始学习如何使用了。
1. Ubuntu下使用pip方式安装tensorflow的更多相关文章
- 深度学习框架之TensorFlow的概念及安装(ubuntu下基于pip的安装,IDE为Pycharm)
2015年11月9日,Google发布人工智能系统TensorFlow并宣布开源. 1.TensorFlow的概念 TensorFlow 是使用数据流图进行数值计算的开源软件库.也就是说,Tensor ...
- ubuntu下源码方式安装php5.4
一.安装前准备 下载php-5.4.13.tar.gz最新版本放到/user/src目录下 二.安装 因为在安装php过程中,会依赖安装很多库,为了不让你反复安装,建议按步骤操作 安装autoconf ...
- Ubuntu系统---以virtualenv方式安装Tensorflow-CPU
Ubuntu系统---以virtualenv方式安装Tensorflow-CPU 一.安装环境 环境:Ubuntu18.04+CPU+python2.7 本文介绍:如何在ubuntu上以virtual ...
- ubuntu 14.04 下利用apt-get方式安装opencv
转载,请注明出处:http://blog.csdn.net/tina_ttl 目录(?)[+] 标签(空格分隔): Linux学习 OpenCV ubuntu 1404 下利用apt-get方式安装O ...
- Win10+TensorFlow-gpu pip方式安装,anaconda方式安装
中文官网安装教程:https://www.tensorflow.org/install/install_windows#determine_how_to_install_tensorflow 1.安装 ...
- Ubuntu 下生成 python 环境安装文件 requirements.txt
参考: 查找python项目依赖并生成requirements.txt Ubuntu 下生成 python 环境安装文件 requirements.txt 首先通过 pip 安装pyreqs模块: p ...
- pip方式安装Jupyter
pip方式安装Jupyter 如你的cmd命令窗口无法识别pip命令,请配置下环境变量(将python的''Scripts''文件夹路径添加至''path''变量里面). 使用以下命令更新pip和安装 ...
- 基于Ubuntu下以Docker方式gitlab软件的部署
基于Ubuntu下以Docker方式gitlab软件的部署 目录 基于Ubuntu下以Docker方式gitlab软件的部署 1.安装Docker Compose 1.1 下载curl 1.2 安装c ...
- Ubuntu 下 firebird 数据库的安装和配置
Ubuntu 下 firebird 数据库的安装和配置 1.简介 本文主要是 Ubuntu 下 firebird 数据库的安装和目录迁移,同样适用于 Debian 系统:Ubuntu 20.0.4 f ...
随机推荐
- [LeetCode] 269. Alien Dictionary 另类字典
There is a new alien language which uses the latin alphabet. However, the order among letters are un ...
- <a href="javascript:;">的用法说明
<a href="javascript:;">的用法说明 1.标签的 href 属性用于指定超链接目标的 URL,href 属性的值可以是任何有效文档的相对或绝对 UR ...
- 解决 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:reyo' did not find a matching property.
解决办法是:关闭tomcat,双击eclipse下tomcat服务器,在出来的Tomcat server at localhost页面中找到server options选项,选中其中的选项”Publi ...
- TortoiseSVN客户端更改新的URL和账号
一: 变更SVN地址 右键(TortoiseSVN) → Relocate → 输入你新的URL地址 二:变更账号 TortoiseSVN右键->Setting 进入“Setting”之后,也就 ...
- R语言dai xie
R语言,Python长期招代写,作业量充足,需要一定英文能力,价格满意.有意者请留言联系,谢谢
- java如何消除太多的if else判断?
1.简介 if判断语句是很多编程语言的重要组成部分.但是,若我们最终编写了大量嵌套的if语句,这将使得我们的代码更加复杂和难以维护. 让我们看看能否使用别的方式来做呢. 设计模式是为了更好的代码重用性 ...
- [Leetcode] 5279. Subtract the Product and Sum of Digits of an Integer
class Solution { public int subtractProductAndSum(int n) { int productResult = 1; int sumResult = 0; ...
- new/delete与malloc/free的区别
new/delete与malloc/free的区别 参考: https://blog.csdn.net/u013485792/article/details/51329541 https://www. ...
- 01 .NET CORE 2.2 使用OCELOT -- 简单使用
目前参考两篇文章,已实现基本的ocelot的网关功能. https://www.cnblogs.com/xlxr45/p/11320988.html https://www.jianshu.com/p ...
- [Vscode插件] 自动编译项目中的Sass文件为CSS
插件名 : Live Sass Compiler 今天在VSCode中发现了一个自动watch项目目录下sass文件的插件,摆脱了在控制台中进行手动watch的繁琐. 安装好以后点击右下角即可自动编译 ...