代码之家  ›  专栏  ›  技术社区  ›  Archit

在windows上安装tensorflow时出错

  •  0
  • Archit  · 技术社区  · 8 年前

    嗨,我正在尝试用Anaconda安装tensorflow。我遵循官方网站的指示:

    https://www.tensorflow.org/install/install_windows

    conda create -n tensorflow pip python=3.5

    activate tensorflow

    (tensorflow) C:\Users\guar8001>pip install tensorflow

    我收到以下错误:

    (tensorflow) C:\Users\guar8001>pip install tensorflow
    Collecting tensorflow
      Using cached tensorflow-1.7.0-cp35-cp35m-win_amd64.whl
    
    Exception:
    Traceback (most recent call last):
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\shutil.py", line 391, in _rmtree_unsafe
        os.rmdir(path)
    OSError: [WinError 145] The directory is not empty: 'C:\\Users\\guar8001\\AppData\\Local\\Temp\\pip-install-fkfkeii_\\tensorflow\\tensorflow-1.7.0.data\\purelib\\tensorflow\\python'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\basecommand.py", line 228, in main
        status = self.run(options, args)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\commands\install.py", line 388, in run
        wheel_cache.cleanup()
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\utils\temp_dir.py", line 58, in __exit__
        self.cleanup()
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\utils\temp_dir.py", line 81, in cleanup
        rmtree(self.path)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\retrying.py", line 49, in wrapped_f
        return Retrying(*dargs, **dkw).call(f, *args, **kw)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\retrying.py", line 212, in call
        raise attempt.get()
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\retrying.py", line 247, in get
        six.reraise(self.value[0], self.value[1], self.value[2])
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\six.py", line 693, in reraise
        raise value
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\retrying.py", line 200, in call
        attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\utils\misc.py", line 108, in rmtree
        onerror=rmtree_errorhandler)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\shutil.py", line 494, in rmtree
        return _rmtree_unsafe(path, onerror)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\shutil.py", line 384, in _rmtree_unsafe
        _rmtree_unsafe(fullname, onerror)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\shutil.py", line 384, in _rmtree_unsafe
        _rmtree_unsafe(fullname, onerror)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\shutil.py", line 384, in _rmtree_unsafe
        _rmtree_unsafe(fullname, onerror)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\shutil.py", line 384, in _rmtree_unsafe
        _rmtree_unsafe(fullname, onerror)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\shutil.py", line 384, in _rmtree_unsafe
        _rmtree_unsafe(fullname, onerror)
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\shutil.py", line 393, in _rmtree_unsafe
        onerror(os.rmdir, path, sys.exc_info())
      File "c:\users\guar8001\appdata\local\continuum\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\utils\misc.py", line 120, in rmtree_errorhandler
        func(path)
    OSError: [WinError 145] The directory is not empty: 'C:\\Users\\guar8001\\AppData\\Local\\Temp\\pip-install-fkfkeii_\\tensorflow\\tensorflow-1.7.0.data\\purelib\\tensorflow\\python'
    

    如何安装tensorflow。

    1 回复  |  直到 8 年前
        1
  •  0
  •   Sr7    8 年前

    我可以想到几个场景:

    1.在窗口中打开生成目录

    2.防病毒

    其中,两秒钟是暂时的,等待可能会解决问题。我怀疑第一个(在窗口中打开)是更一般的“某物正在使用目录作为cwd”的一个实例,它在该进程完成之前不会消失(并且可能发生的情况是,一个持久的后台进程以目录作为cwd结束,这意味着它在重新启动之前不会消失)。