2017-03-15 58 views
0

非常感謝您閱讀本文。 我試過搜索,但無法找到答案。 我一直在使用python 3.5.2在Windows 8.1上使用pip安裝tensorflow。我得到這個錯誤。python tensorflow窗口異常

C:\Users\Default.HP>pip3 install --upgrade tensorflow 

Collecting tensorflow 
    Using cached tensorflow-1.0.1-cp35-cp35m-win_amd64.whl 
Collecting numpy>=1.11.0 (from tensorflow) 
    Using cached numpy-1.12.0-cp35-none-win_amd64.whl 
Collecting six>=1.10.0 (from tensorflow) 
    Using cached six-1.10.0-py2.py3-none-any.whl 
Collecting protobuf>=3.1.0 (from tensorflow) 
    Using cached protobuf-3.2.0-py2.py3-none-any.whl 
Collecting wheel>=0.26 (from tensorflow) 
    Using cached wheel-0.29.0-py2.py3-none-any.whl 
Collecting setuptools (from protobuf>=3.1.0->tensorflow) 
    Using cached setuptools-34.3.2-py2.py3-none-any.whl 
Collecting appdirs>=1.4.0 (from setuptools->protobuf>=3.1.0->tensorflow) 
    Using cached appdirs-1.4.3-py2.py3-none-any.whl 
Collecting packaging>=16.8 (from setuptools->protobuf>=3.1.0->tensorflow) 
    Using cached packaging-16.8-py2.py3-none-any.whl 
Collecting pyparsing (from packaging>=16.8->setuptools->protobuf>=3.1.0->tensorf 
low) 
    Using cached pyparsing-2.2.0-py2.py3-none-any.whl 
Installing collected packages: numpy, six, appdirs, pyparsing, packaging, setupt 
ools, protobuf, wheel, tensorflow 
Exception: 
Traceback (most recent call last): 
    File "c:\program files\python35\lib\site-packages\pip\basecommand.py", line 20 
9, in main 
    status = self.run(options, args) 
    File "c:\program files\python35\lib\site-packages\pip\commands\install.py", li 
ne 317, in run prefix=options.prefix_path, 
    File "c:\program files\python35\lib\site-packages\pip\req\req_set.py", line 73 
2, in install 
    **kwargs 
    File "c:\program files\python35\lib\site-packages\pip\req\req_install.py", lin 
e 835, in install 
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix) 
    File "c:\program files\python35\lib\site-packages\pip\req\req_install.py", lin 
e 1030, in move_wheel_files isolated=self.isolated, 
    File "c:\program files\python35\lib\site-packages\pip\wheel.py", line 344, in 
move_wheel_files 
    clobber(source, lib_dir, True) 
    File "c:\program files\python35\lib\site-packages\pip\wheel.py", line 315, in 
clobber 
    ensure_dir(destdir) 
    File "c:\program files\python35\lib\site-packages\pip\utils\__init__.py", line 
83, in ensure_dir 
    os.makedirs(path) 
    File "c:\program files\python35\lib\os.py", line 241, in makedirs 
    mkdir(name, mode) 
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\Li 
b\\site-packages\\numpy' 
You are using pip version 8.1.1, however version 9.0.1 is available. 
You should consider upgrading via the 'python -m pip install --upgrade pip' comm 
and. 

當試圖升級點子,然後我得到這個錯誤

C:\Users\Default.HP>python -m pip install --upgrade pip 

Collecting pip 
    Using cached pip-9.0.1-py2.py3-none-any.whl 
Installing collected packages: pip 
    Found existing installation: pip 8.1.1 
    Uninstalling pip-8.1.1: 
Exception: 
Traceback (most recent call last): 
    File "C:\Program Files\Python35\lib\shutil.py", line 538, in move 
    os.rename(src, real_dst) 
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\li 
b\\site-packages\\pip-8.1.1.dist-info\\description.rst' -> 'C:\\Users\\Default.H 
P\\AppData\\Local\\Temp\\pip-0fd55_is-uninstall\\program files\\python35\\lib\\s 
ite-packages\\pip-8.1.1.dist-info\\description.rst' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "C:\Program Files\Python35\lib\site-packages\pip\basecommand.py", line 20 
9, in main 
    status = self.run(options, args) 
    File "C:\Program Files\Python35\lib\site-packages\pip\commands\install.py", li 
ne 317, in run 
    prefix=options.prefix_path, 
    File "C:\Program Files\Python35\lib\site-packages\pip\req\req_set.py", line 72 
6, in install 
    requirement.uninstall(auto_confirm=True) 
    File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", lin 
e 746, in uninstall 
    paths_to_remove.remove(auto_confirm) 
    File "C:\Program Files\Python35\lib\site-packages\pip\req\req_uninstall.py", l 
ine 115, in remove 
    renames(path, new_path) 
    File "C:\Program Files\Python35\lib\site-packages\pip\utils\__init__.py", line 
267, in renames 
    shutil.move(old, new) 
    File "C:\Program Files\Python35\lib\shutil.py", line 553, in move 
    os.unlink(src) 
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\li 
b\\site-packages\\pip-8.1.1.dist-info\\description.rst' 
You are using pip version 8.1.1, however version 9.0.1 is available. 
You should consider upgrading via the 'python -m pip install --upgrade pip' comm 
and. 

這又如何解決呢?

非常感謝。

+0

看起來像'pip'和'numpy'升級失敗,因爲它們是由管理員用戶安裝的。您可以嘗試在[管理員命令提示符](https://technet.microsoft.com/en-us/library/cc947813(v = ws.10).aspx)中運行相同的命令,或者創建一個virtualenv作爲當前用戶並在那裏安裝它。 – mrry

+0

非常感謝。這很好。乾杯。 – eng

回答

1

pip(以非管理員用戶身份運行)試圖升級由管理員用戶安裝的軟件包時,會出現此權限錯誤。有兩種主要的解決方法:

  1. 使用Administrator command prompt運行升級命令。
  2. 將TensorFlow安裝到由非管理員用戶擁有的virtualenv中。