如何将sudo pip install libary更改为anaconda

时间:2016-12-15 08:31:49

标签: python ubuntu tensorflow

我的操作系统是ubuntu 14.04.now,我想在anaconda2中安装tensorflow而我不使用root。我下载了anaconda2并安装在/usr/anaconda2。我输入命令为:

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写文件的权限......我该怎么办?

1 个答案:

答案 0 :(得分:0)

Anaconda自带一个名为conda的软件包管理器,用于在Anaconda环境中安装软件包,而不是默认的python

conda update conda
conda install <package name>

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

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

然后安装:
conda install tensorflow