2016-12-15 70 views
2

我的操作系统是ubuntu 14.04.now,我想在anaconda2中安装tensorflow,并且我没有使用root。我下载了anaconda2并安装在/usr/anaconda2。我键入命令为:如何将sudo pip install libary更改为anaconda

sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl 

但在/usr/anaconda2/bin/python中,我无法导入张量流。我发现sudo pip在ubuntu默认python2.7.6中安装tensorflow。所以,我尝试没有sudo安装它,但:

running build_scripts 
creating build/scripts.linux-x86_64-2.7 
Creating build/scripts.linux-x86_64-2.7/f2py 
adding 'build/scripts.linux-x86_64-2.7/f2py' to scripts 
changing mode of build/scripts.linux-x86_64-2.7/f2py from 664 to 775 
running install_lib 
creating /usr/anaconda2/pkgs/lib 
error: could not create '/usr/anaconda2/pkgs/lib': Permission denied 

---------------------------------------- 


Command "/home/ds/.conda/envs/tensorflow_env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-THK_wR/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-znMmTV-record/install-record.txt --single-version-externally-managed --compile --prefix=/usr/anaconda2/pkgs" failed with error code 1 in /tmp/pip-build-THK_wR/numpy/ 

我无权写/usr/anaconda2文件...我应该怎么办?

+0

你做什么执行水蟒蟒?你应该做一些类似的事情来执行anaconda pip,但使用sudo。 – Goyo

+0

如果我没有使用sudo,它会得到一个错误:OSError:[Errno 13] Permission denied:'/usr/anaconda2/lib/python2.7/sitepackages/numpy/version.pyc'。如果我不执行anaconda python,如何使用anaconda lib? – zhangyh

回答

0

蟒蛇本身自带的包管理器叫做conda,安装在蟒蛇环境包,而不是默认的python

conda update conda
conda install <package name>

你的情况:
conda install -c conda-forge tensor flow

或者您可以先添加频道:
conda config --add channels conda-forge

然后安装方式:
conda install tensorflow

+0

当我运行conda install -c condo-forge tensorflow时,它会得到一个错误:CondaHTTPError:HTTP错误:找不到URL https://conda.anaconda.org/condo-forge/linux-64/可能是anaconda天堂这个库。 – zhangyh

+0

对不起,它假设是'conda install -c conda-forge tensorflow''这只是一个打字错误。 –

+0

嘿,你试过了吗? –