分享知识,分享快乐

0%

anaconda3-5.2.0+python3.6.5+tensorflow1.11.0

anaconda3-5.2.0

官网
https://www.anaconda.com/

历史版本下载地址

1
2
3
https://repo.continuum.io/archive/
https://repo.anaconda.com/archive/
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=N&O=D

win10安装

https://blog.51cto.com/acevi/2103437

linux 7 安装 anaconda 3-5.2.0 tensorflow1.11.0

https://blog.51cto.com/moerjinrong/2155178

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
安装
chmod +x Anaconda3-5.2.0-Linux-x86_64.sh
./Anaconda3-5.2.0-Linux-x86_64.sh
安装过程中会需要不断回车来阅读并同意license。安装路径默认为用户目录(可以自己指定),最后需要确认将路径加入用户的.bashrc中。
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>> # 要继续安装过程,请查看许可证协议。请按ENTER继续

然后按空格阅读许可协议,

Do you accept the license terms? [yes|no]
[no] >>> yes # 是否接受协议,选yes

Anaconda3 will now be installed into this location:
/root/anaconda3

- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below

[/root/anaconda3] >>> # 是否安装到当前家目录的anaconda3目录中,默认回车即可

Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /root/.bashrc ? [yes|no]
[no] >>> yes # 是否添加环境变量到/root/.bashrc文件
重新加载环境变量,执行:

source ~/.bashrc
python -V
pip list
conda list

silent install

1
[xy_zhangpeng@bigdata-2 ~]$ bash Anaconda3-5.2.0-Linux-x86_64.sh -b -p $HOME/anaconda3 -f

To run the silent installation of Miniconda for macOS or Linux, specify the -b and -p arguments of the bash installer. The following arguments are supported:

  • -b—Batch mode with no PATH modifications to ~/.bashrc. Assumes that you agree to the license agreement. Does not edit the .bashrc or .bash_profile files.
  • -p—Installation prefix/path.
  • -f—Force installation even if prefix -p already exists.

tensorflow 在 anaconda。。

https://www.anaconda.com/tensorflow-in-anaconda/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
安装Tensorflow



如果GPU是NVIDIA的,就可以安装GPU版本的TensorFlow;如果不是,安装CPU版本的就好了。



1.因为要下载Tensorflow,所以我先在Anaconda的配置文件中添加清华镜像库,这样下载和更新的速度会快很多,命令:


conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
#查看
conda config --show

#CPU版本
pip install --upgrade tensorflow

#GPU版本
pip install --upgrade tensorflow-gpu

#指定版本
pip install tensorflow==1.11.0

分布式TF

https://www.jianshu.com/p/fdb93e44a8cc

例子

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 引入 tensorflow 模块
import tensorflow as tf

# 创建一个整型常量,即 0 阶 Tensor
t0 = tf.constant(3, dtype=tf.int32)

# 创建一个浮点数的一维数组,即 1 阶 Tensor
t1 = tf.constant([3., 4.1, 5.2], dtype=tf.float32)

# 创建一个字符串的2x2数组,即 2 阶 Tensor
t2 = tf.constant([['Apple', 'Orange'], ['Potato', 'Tomato']], dtype=tf.string)

# 创建一个 2x3x1 数组,即 3 阶张量,数据类型默认为整型
t3 = tf.constant([[[5], [6], [7]], [[4], [3], [2]]])

# 打印上面创建的几个 Tensor
print(t0)
print(t1)
print(t2)
print(t3)
---------------------
作者:戈云飞
来源:CSDN
原文:https://blog.csdn.net/geyunfei_/article/details/78782804
版权声明:本文为博主原创文章,转载请附上博文链接!

参考

https://cloud.tencent.com/developer/article/1078485

https://cloud.tencent.com/developer/article/1078028

parcel包安装

1
2
3
https://repo.anaconda.com/pkgs/misc/parcels/
替换为
https://repo.continuum.io/pkgs/misc/parcels/

离线下载tensorlfow。 Keras

方法:在有网络的机器下载好。zip到离线服务器。

  • download
1
2
3
4
5
6
7

pip download msgpack-python==0.5.6 -d pip_package


mkdir pip_package
pip download tensorflow==1.11.0 -d pip_package
zip -r pip_package.zip pip_package
  • install
1
2


1
2
3
4
5
6
7
8
9
10

http://mirrors.aliyun.com/pypi/simple/tensorflow/

http://mirrors.aliyun.com/pypi/packages/2c/0c/74410a32bf753b280b28b685dc6620c65ccc3a09494398d47198af9f2bbb/tensorflow-1.11.0rc2-cp36-cp36m-manylinux1_x86_64.whl#sha256=b137211744ccbfec6fd5a5f62a47ce1a467fd760be8169a38c7a88121e8f6341


http://mirrors.aliyun.com/pypi/packages/5e/10/aa32dad071ce52b5502266b5c659451cfd6ffcbf14e6c8c4f16c0ff5aaab/Keras-2.2.4-py2.py3-none-any.whl#sha256=794d0c92c6c4122f1f0fcf3a7bc2f49054c6a54ddbef8d8ffafca62795d760b6


pip install xxx.whl

anaconda cdh parcels

1
2
3
4
https://www.cloudera.com/downloads/partner/anaconda.html
https://docs.anaconda.com/anaconda-scale/cloudera-cdh/
http://docs.anaconda.com/anaconda-repository/user-guide/tasks/work-with-cloudera-parcels/
https://www.anaconda.com/how-to-generate-custom-anaconda-parcels-for-cloudera-cdh-with-anaconda-enterprise-5/

histroy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
1063  bash Anaconda3-5.2.0-Linux-x86_64.sh  -b -p /opt/anaconda3 -f
1064 ll /opt/
1065 python -V
1066 ll
1067 cd /opt/
1068 ll
1069 cd anaconda3/
1070 ll
1071 ./bin/python -V
1072 ./bin/conda -V
1074 ./bin/conda config -h
1075 ./bin/conda config --show
1077 ./bin/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
1078 ./bin/conda config --show
1080 ./bin/conda config --set show_channel_urls yes
1081 ./bin/conda config --show
1082 ./pip -V
1083 ./bin/pip -V
1084 ./bin/pip install tensorflow==1.11.0
1085 ./bin/pip list all

Tensorflow报错 tf.estimator package not installed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
1、tf.estimator package 未安装
tf.estimator package not installed

我使用的环境是:
anaconda 5.2.0, Python 3.6和TensorFlow 1.12
然后在网上找了一下解决方案之后,发现需要更新一下numpy、pandas和matplotlib等package:
pip install -U pandas
pip install -U matplotlib

将pandas的版本更新到了0.23.4,matplotlib更新到3.0.2就好了,然后import TensorFlow的时候就不会报错了

2、import tensorflow的提醒
FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters

这个问题还是环境问题,h5py出了问题,对h5py进行一个升级了就,后面再import tensorflow的时候,就不会出错了。
pip install h5py==2.8.0rc1

3、
TypeError: __init__() got an unexpected keyword argument 'serialized_options'

很有可能是,终端上的 protoc 版本 与python库内的protobuf版本不一样。
pip install -U protobuf

4、将Python程序不挂断的跑到服务器上面,
注意CUDA_VISIBLE_DEVICES=0需要放在nohup的前面。
CUDA_VISIBLE_DEVICES=0 nohup python -u main.py

作者:奔向算法的喵
链接:https://www.jianshu.com/p/2ea51363b080
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。