我正在使用Conda使用以下命令将Tensorflow 1.15安装到新环境中:
conda create -p ./env_tf python=3.6.5 -y
conda activate ./env_tf
conda install -c conda-forge tensorflow-gpu=1.15 -y
conda list
的结果:
(C:\Projects\pythonEnvDeployment\env_tf) PS C:\Projects\pythonEnvDeployment> conda list
# packages in environment at C:\Projects\pythonEnvDeployment\env_tf:
#
# Name Version Build Channel
_tflow_select 2.1.0 gpu
absl-py 0.9.0 py36_0 conda-forge
astor 0.7.1 py_0 conda-forge
blas 1.0 mkl
ca-certificates 2019.11.28 hecc5488_0 conda-forge
certifi 2019.11.28 py36_0 conda-forge
cudatoolkit 10.0.130 0
cudnn 7.6.5 cuda10.0_0
gast 0.2.2 py_0 conda-forge
google-pasta 0.1.8 py_0 conda-forge
grpcio 1.23.0 py36h3db2c7e_0 conda-forge
h5py 2.10.0 nompi_py36h422b98e_101 conda-forge
hdf5 1.10.5 nompi_ha405e13_1104 conda-forge
icc_rt 2019.0.0 h0cc432a_1
keras-applications 1.0.8 py_1 conda-forge
keras-preprocessing 1.1.0 py_0 conda-forge
libblas 3.8.0 8_mkl conda-forge
libcblas 3.8.0 8_mkl conda-forge
liblapack 3.8.0 8_mkl conda-forge
libprotobuf 3.11.2 h1a1b453_0 conda-forge
llvm-openmp 9.0.1 2 conda-forge
m2w64-gcc-libgfortran 5.3.0 6
m2w64-gcc-libs 5.3.0 7
m2w64-gcc-libs-core 5.3.0 7
m2w64-gmp 6.1.0 2
m2w64-libwinpthread-git 5.0.0.4634.697f757 2
markdown 3.1.1 py_0 conda-forge
mkl 2019.5 281 conda-forge
mkl-service 2.3.0 py36hfa6e2cd_0 conda-forge
msys2-conda-epoch 20160418 1
numpy 1.17.5 py36hc71023c_0 conda-forge
openssl 1.1.1d hfa6e2cd_0 conda-forge
opt_einsum 3.1.0 py_0 conda-forge
pip 19.3.1 py36_0
protobuf 3.11.2 py36he025d50_0 conda-forge
pyreadline 2.1 py36_1001 conda-forge
python 3.6.5 h0c2934d_0
scipy 1.3.1 py36h29ff71c_0 conda-forge
setuptools 44.0.0 py36_0
six 1.14.0 py36_0 conda-forge
tensorboard 1.15.0 py36_0 conda-forge
tensorflow 1.15.0 gpu_py36h2b26d6b_0
tensorflow-base 1.15.0 gpu_py36h1afeea4_0
tensorflow-estimator 1.15.1 pyh2649769_0
tensorflow-gpu 1.15.0 h0d30ee6_0
termcolor 1.1.0 py_2 conda-forge
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
werkzeug 0.16.0 py_0 conda-forge
wheel 0.33.6 py36_0
wincertstore 0.2 py36h7fe50ca_0
wrapt 1.11.2 py36hfa6e2cd_0 conda-forge
zlib 1.2.11 h2fa13f4_1006 conda-forge
但是,当我尝试在python提示符下验证TF版本时,我得到的是1.9.0:
(C:\Projects\pythonEnvDeployment\env_tfPS C:\Projects\pythonEnvDeployment> python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
C:\Users\XYZ\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\XYZ\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\XYZ\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\XYZ\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\XYZ\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\XYZ\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
>>> tf.__version__
'1.9.0'
在此过程中我缺少步骤吗?预先感谢。
答案 0 :(得分:1)
正如@James 所评论的,看起来您已经激活了不同的 conda 环境。
按照以下步骤使用 conda 安装 Tensorflow
#Set Up Anaconda Environment
$conda create -n env_tf python=3.6.5
#Activate the new Environment
$source activate env_tf
#Install tensorflow
(env_tf) $ conda install -c conda-forge tensorflow-gpu=1.15
#Verify Tensorflow installation
(env_tf) $ python
>>import tensorflow as tf
>>tf.__version__
1.15