2017-03-17 158 views
1

我正嘗試按照此網頁上的說明將tensorflow安裝到帶有virtualenv的python3。我正在使用Mac Sierra,並且python2.7和python3.5都在我的機器上。 https://www.tensorflow.org/install/install_mac#installing_with_virtualenv使用Virtualenv將Tensorflow安裝到Python3

使用這種方法工作得很好了python2.7,但失敗python3.5。以下是我發佈的錯誤消息pip3 install --upgrade tensorflow

Installing collected packages: tensorflow, setuptools 
Exception: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main 
    status = self.run(options, args) 
    File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run 
    prefix=options.prefix_path, 
    File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 742, in install 
    **kwargs 
    File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 831, in install 
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix) 
    File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files 
    isolated=self.isolated, 
    File "/Library/Python/2.7/site-packages/pip/wheel.py", line 346, in move_wheel_files 
    clobber(source, lib_dir, True) 
    File "/Library/Python/2.7/site-packages/pip/wheel.py", line 317, in clobber 
    ensure_dir(destdir) 
    File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir 
    os.makedirs(path) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs 
    mkdir(name, mode) 
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/tensorflow-1.0.1.dist-info' 
You are using pip version 8.1.2, however version 9.0.1 is available. 
You should consider upgrading via the 'pip install --upgrade pip' command. 

任何幫助,將不勝感激。

回答

1

用於virtualenv的解釋器必須在創建時指定。在這種情況下,請使用virtualenv -p python3 ./tensorflow指定python3作爲此特定virtualenv的解釋器。