安装Tensorflow时,出现CondaVerificationError。

问题描述 投票:3回答:1

我在64位Win10上安装Tensorflow时,得到了一个CondaVerificationError。

CondaVerificationError: The package for tensorflow-estimator located at C:\Users\viviennejia.zhong\AppData\Local\Continuum\anaconda3\pkgs\tensorflow-estimator-1.13.0-py37h39e3cac_0
appears to be corrupted. The path 'Lib/site-packages/tensorflow_estimator/python/estimator/canned/linear_optimizer/python/utils/__pycache__/sharded_mutable_dense_hashtable.cpython-37.pyc'
specified in the package manifest cannot be found.

ClobberError: This transaction has incompatible packages due to a shared path.
packages: conda-forge::tensorboard-1.13.1-py37_0, conda-forge::tensorflow-base-1.13.1-py37_7
path: 'scripts/tensorboard-script.py'

ClobberError: This transaction has incompatible packages due to a shared path.
packages: conda-forge::tensorboard-1.13.1-py37_0, conda-forge::tensorflow-base-1.13.1-py37_7
path: 'scripts/tensorboard.exe'

在一些帖子中我看到 conda clean --all 可以帮助。运行这个,我得到了

FileNotFoundError: [WinError 3] 'C:\\Users\\xxxx\\AppData\\Local\\Continuum\\anaconda3\\pkgs\\tensorflow-base-2.0.0-mkl_py37hd1d5974_0\\Lib\\site-packages\\tensorflow-2.0.0.data\\purelib\\tensorflow_core\\include\\tensorflow_core\\core\\common_runtime\\isolate_placer_inspection_required_ops_pass.h'

我是Conda的新手,非常感谢你的帮助,以解决这个问题。

python tensorflow install conda
1个回答
0
投票

在这里提供解决方案(答案部分),尽管它存在于评论部分,以利于社区。

通过pip安装Tensorflow已经解决了问题。

pip install tensorflow (install latest version)

pip install tensorflow==2.0 (for older version)

除了上述方法外,还有一种推荐的方法是创建一个 Virtual EnvironmentAnaconda 并安装 Tensorflow 在那 Virtual Environment在大多数情况下,它都是有效的。

使用虚拟环境有以下优点

  • 我们可以维护多个版本的 Tensorflow 在多个 Virtual Environments 与各 Virtual Environment 由每个 version 喜欢 1.14, 1.15, 2.0, 2.1, 2.2,etc..
  • 我们可以使用不同的 Python Versions (2.x, 3.6, 3.7)在每个 Virtual Environment
  • 如果我们要修改 source code 的任何Tensorflow API,我们可以在我们的虚拟环境中进行,而不影响其在其他环境中的功能。Virtual Environments.

创建新的虚拟环境并安装的步骤 . TensorflowAnaconda不同的操作系统,如下图所示。

# Create a New Virtual Environment
conda create --name TF_2_VE

# When conda asks you to proceed, type y:
proceed ([y]/n)?

# Activate the Virtual Environment. Conda Version > 4.6 
conda activate TF_2_VE

# Activating Virtual Environment, Conda Version < 4.6 and Windows OS
activate TF_2_VE

# Activating Virtual Environment, Conda Version < 4.6 and Linux and Mac OS
source activate TF_2_VE


# Install the TF Version you need
conda install tensorflow

上述命令将安装 Latest VersionTensorflow (2.2 截至目前)。) 如果你想要一个旧版本,如 2.0,你可以将上述命令集的最后一步替换为

conda install tensorflow==2.0.

© www.soinside.com 2019 - 2024. All rights reserved.