安装Tensorflow时出现CondaVerificationError [英] Got CondaVerificationError when installing Tensorflow
问题描述
在我的64位Win10上安装Tensorflow时出现CondaVerificationError。
I got a CondaVerificationError when installing Tensorflow on my 64-bit Win10.
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
可以帮助您。运行此命令,我得到
In some posts I saw conda clean --all
could help. Runing this, I got
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是我的新手,非常感谢您为解决此问题所提供的帮助。
I am new to conda and appreciate very much your help to solve this issue.
推荐答案
在此处提供解决方案(答案部分),即使它存在于注释部分中也可以为社区带来好处。
Providing the solution here (Answer Section), even though it is present in the Comment Section, for the benefit of the community.
通过pip安装Tensorflow已解决问题
Installation of Tensorflow through pip has resolved issue
pip install tensorflow (install latest version)
或
pip install tensorflow==2.0 (for older version)
除上述方法外,还有推荐的方法是在 Anaconda
中创建虚拟环境
并安装 Tensorflow
在该虚拟环境
中,在大多数情况下都可以使用。
In addition to above method, there is a recommended way is to create a Virtual Environment
in Anaconda
and install the Tensorflow
in that Virtual Environment
, which works in most of the cases.
使用虚拟环境具有优势像
Using Virtual Environments has advantages like
- 我们可以在多个
Tensorflow
的多个版本>虚拟环境,每个虚拟环境
包括每个版本
,例如1.14、1.15、2.0、2.1、2.2等。
- 我们可以使用不同的
Python版本
(2.x,3.6、3.7
)在每个虚拟环境
- 如果我们想修改任何Tensorflow API的
源代码
,我们可以在虚拟环境中完成此操作,而不会影响其在其他Virtual中的功能环境
。
- We can maintain multiple versions of
Tensorflow
in multipleVirtual Environments
with eachVirtual Environment
comprising eachversion
like1.14, 1.15, 2.0, 2.1, 2.2,etc..
- We can use different
Python Versions
(2.x, 3.6, 3.7
) in eachVirtual Environment
- If we want to modify the
source code
of any of the Tensorflow API, we can do it within our Virtual Environment, without impacting its functionality in otherVirtual Environments
.
创建新虚拟环境和安装 Tensorflow的步骤对于不同的操作系统,
Anaconda
中的code>如下所示:
Steps for Creating a New Virtual Environment and installing Tensorflow
in Anaconda
, for different Operating Systems, is shown below:
# 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
上述命令将安装 Tensorflow $的
最新版本
c $ c>(截至目前的 2.2
)。如果要使用较旧的版本,例如 2.0
,则可以用
The above command will install the Latest Version
of Tensorflow
(2.2
as of now). If you want an older version like 2.0
, you can replace the last step of the above set of commands with
代替上述命令的最后一步。 conda install tensorflow == 2.0
。
conda install tensorflow==2.0
.
这篇关于安装Tensorflow时出现CondaVerificationError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!