Ubuntu16.04 conda 中 TensorFlow使用

报错

import tensorflow as tf
Segmentation fault (core dumped)

conda 环境下 python 版本

(base) 22@111:~$ python -V
Python 3.7.11

查看 pip 安装的库

pip list

Anaconda的python版本是3.7的,我们创建一个Python的虚拟环境以支持TensorFlow

(base) 22@111:~$ conda create --name tf python=3.6
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/wym/project/cpu_gpu/anaconda3/envs/tf

  added / updated specs:
    - python=3.6


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _openmp_mutex-4.5          |            1_gnu          22 KB
    ca-certificates-2021.10.26 |       h06a4308_2         115 KB
    certifi-2020.6.20          |     pyhd3eb1b0_3         155 KB
    ncurses-6.3                |       h7f8727e_2         782 KB
    pip-21.2.2                 |   py36h06a4308_0         1.8 MB
    python-3.6.13              |       h12debd9_1        32.5 MB
    setuptools-58.0.4          |   py36h06a4308_0         788 KB
    ------------------------------------------------------------
                                           Total:        36.1 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  _openmp_mutex      pkgs/main/linux-64::_openmp_mutex-4.5-1_gnu
  ca-certificates    pkgs/main/linux-64::ca-certificates-2021.10.26-h06a4308_2
  certifi            pkgs/main/noarch::certifi-2020.6.20-pyhd3eb1b0_3
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.35.1-h7274673_9
  libffi             pkgs/main/linux-64::libffi-3.3-he6710b0_2
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-9.3.0-h5101ec6_17
  libgomp            pkgs/main/linux-64::libgomp-9.3.0-h5101ec6_17
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-9.3.0-hd4cf53a_17
  ncurses            pkgs/main/linux-64::ncurses-6.3-h7f8727e_2
  openssl            pkgs/main/linux-64::openssl-1.1.1l-h7f8727e_0
  pip                pkgs/main/linux-64::pip-21.2.2-py36h06a4308_0
  python             pkgs/main/linux-64::python-3.6.13-h12debd9_1
  readline           pkgs/main/linux-64::readline-8.1-h27cfd23_0
  setuptools         pkgs/main/linux-64::setuptools-58.0.4-py36h06a4308_0
  sqlite             pkgs/main/linux-64::sqlite-3.36.0-hc218d9a_0
  tk                 pkgs/main/linux-64::tk-8.6.11-h1ccaba5_0
  wheel              pkgs/main/noarch::wheel-0.37.0-pyhd3eb1b0_1
  xz                 pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
  zlib               pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3


Proceed ([y]/n)? 
Downloading and Extracting Packages
pip-21.2.2           | 1.8 MB    | ################################################################################################################## | 100% 
_openmp_mutex-4.5    | 22 KB     | ################################################################################################################## | 100% 
python-3.6.13        | 32.5 MB   | ################################################################################################################## | 100% 
ca-certificates-2021 | 115 KB    | ################################################################################################################## | 100% 
setuptools-58.0.4    | 788 KB    | ################################################################################################################## | 100% 
certifi-2020.6.20    | 155 KB    | ################################################################################################################## | 100% 
ncurses-6.3          | 782 KB    | ################################################################################################################## | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate tf
#
# To deactivate an active environment, use
#
#     $ conda deactivate
conda remove --name tf --all  #删除tf环境(全部删除)
(base) 22@111:~$ conda activate tf
(tf) 22@111:~$ pip list
Package    Version
---------- ---------
certifi    2020.6.20
pip        21.2.2
setuptools 58.0.4
wheel      0.37.0

安装TensorFlow

pip install tensorflow==1.5.0

测试

(tf) 22@111:~$ python
Python 3.6.13 |Anaconda, Inc.| (default, Jun  4 2021, 14:25:59) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值