【问题标题】:Unable to upgrade to tensorflow v1.0 on WIndows无法在 Windows 上升级到 tensorflow v1.0
【发布时间】:2017-07-06 06:31:27
【问题描述】:

我尝试在最近发布后升级到 TensorFlow v1.0,但 pip 无法为我安装它。我最初是用

安装的

pip install tensorflow-gpu

并试图运行

pip install --upgrade tensorflow-gpu

但我得到了以下输出:

C:\tensorflow_projects\Cinder\blocks\my-tensorflow\example_mnist\python [master ≡ +1 ~1 -0 !]> pip install --upgrade tensorflow-gpu
Collecting tensorflow-gpu
  Using cached tensorflow_gpu-1.0.0-cp35-cp35m-win_amd64.whl
Requirement already up-to-date: wheel>=0.26 in c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages (from tensorflow-gpu)
Requirement already up-to-date: numpy>=1.11.0 in c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages (from tensorflow-gpu)
Requirement already up-to-date: six>=1.10.0 in c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages (from tensorflow-gpu)
Requirement already up-to-date: protobuf>=3.1.0 in c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages (from tensorflow-gpu)
Collecting setuptools (from protobuf>=3.1.0->tensorflow-gpu)
  Using cached setuptools-34.2.0-py2.py3-none-any.whl
Collecting appdirs>=1.4.0 (from setuptools->protobuf>=3.1.0->tensorflow-gpu)
  Using cached appdirs-1.4.0-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools->protobuf>=3.1.0->tensorflow-gpu)
  Using cached packaging-16.8-py2.py3-none-any.whl
Requirement already up-to-date: pyparsing in c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages (from packaging>=16.8->setuptools->protobuf>=3.1.0-
>tensorflow-gpu)
Installing collected packages: tensorflow-gpu, appdirs, packaging, setuptools
  Found existing installation: tensorflow-gpu 0.12.1
    Uninstalling tensorflow-gpu-0.12.1:
Exception:
Traceback (most recent call last):
  File "c:\users\my_user\appdata\local\programs\python\python35\lib\shutil.py", line 544, in move
    os.rename(src, real_dst)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'c:\\users\\my_user\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\tensorflow
\\contrib\\tensor_forest\\hybrid\\python\\kernel_tests\\__pycache__\\k_feature_routing_function_op_test.cpython-35.pyc' -> 'C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\pip-z9anp1kq-
uninstall\\users\\my_user\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\tensorflow\\contrib\\tensor_forest\\hybrid\\python\\kernel_tests\\__pycache__\\
k_feature_routing_function_op_test.cpython-35.pyc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages\pip\req\req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "c:\users\my_user\appdata\local\programs\python\python35\lib\site-packages\pip\utils\__init__.py", line 267, in renames
    shutil.move(old, new)
  File "c:\users\my_user\appdata\local\programs\python\python35\lib\shutil.py", line 558, in move
    copy_function(src, real_dst)
  File "c:\users\my_user\appdata\local\programs\python\python35\lib\shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "c:\users\my_user\appdata\local\programs\python\python35\lib\shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\pip-z9anp1kq-uninstall\\users\\my_user\\appdata\\local\\programs\\pyth
on\\python35\\lib\\site-packages\\tensorflow\\contrib\\tensor_forest\\hybrid\\python\\kernel_tests\\__pycache__\\k_feature_routing_function_op_test.cpython-35.pyc'

我尝试使用 pip 手动卸载 tensorflow-gpu,但无法卸载,而且看起来除非我能卸载它,否则我无法升级到最新版本。

关于为什么 pip 无法卸载 tensorflow 有什么想法吗?

【问题讨论】:

    标签: python windows tensorflow pip


    【解决方案1】:

    看起来问题在于超过 260 个字符的 Windows 路径长度无法正确解析。

    要解决此问题,请将注册表值 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled 设置为 1。

    我在python 3.5主页上找到了解决方法:

    https://docs.python.org/3/using/windows.html

    【讨论】:

      猜你喜欢
      • 2018-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-21
      • 2022-06-23
      • 2018-09-24
      • 2015-10-21
      相关资源
      最近更新 更多