无法在WIndows上升级到tensorflow v1.0

时间:2017-02-16 22:31:19

标签: python windows tensorflow pip

我尝试在最近发布后升级到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为什么不能卸载张量流的任何想法?

1 个答案:

答案 0 :(得分:1)

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

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

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

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