【问题标题】:Change sudo pip install library to anaconda将 sudo pip 安装库更改为 anaconda
【发布时间】:2017-04-30 18:53:29
【问题描述】:

我的操作系统是 Ubuntu 14.04。我想在 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 中,我无法导入 TensorFlow。我发现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 中写入文件。我该怎么办?

【问题讨论】:

  • 你如何执行anaconda python?您应该执行类似的操作来执行 anaconda pip 但使用 sudo。
  • 如果我在不使用 sudo 的情况下使用它,将会出现错误:OSError: [Errno 13] Permission denied: '/usr/anaconda2/lib/python2.7/sitepackages/numpy/version.pyc' .如果我不执行 anaconda python,如何使用 anaconda lib?

标签: tensorflow ubuntu permissions anaconda sudo


【解决方案1】:

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

【讨论】:

  • 当我运行 conda install -c condo-forge tensorflow 时,会报错:CondaHTTPError: HTTP Error: Could not find URL conda.anaconda.org/condo-forge/linux-64 可能是 anaconda 没有这个库。
  • 抱歉,应该是conda install -c conda-forge tensorflow `这只是一个打字错误。
猜你喜欢
  • 2019-12-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-25
  • 2014-10-17
相关资源
最近更新 更多