当我尝试安装 Tensorflow 时,会出现此消息。我使用最新版本的 python 和 pip。
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\julia\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\site-packages\\tensorflow\\include\\external\\com_github_grpc_grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\client_load_reporting_filter.h'
它出现在所有旧版本的 Tensorflow 上。在最新版本中出现:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.2.0
ERROR: No matching distribution found for tensorflow==1.2.0
就我而言,仅手动删除环境目录中包的“剩余部分”即可解决此问题。 路径:...“env\Lib\site-packages\ {包名称}” 请确保在删除任何文件之前进行备份。
我做了一个
pip cache purge
然后
pip install <name>
工作了
发生这种情况是由于最大路径长度限制 您可以从最大路径长度限制获得帮助 之后就可以正确安装TensorFlow了