Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python IOError:[Errno 28]安装TensorFlow时,设备上没有剩余空间_Python_Linux_Python 2.7_Pip_Tensorflow - Fatal编程技术网

Python IOError:[Errno 28]安装TensorFlow时,设备上没有剩余空间

Python IOError:[Errno 28]安装TensorFlow时,设备上没有剩余空间,python,linux,python-2.7,pip,tensorflow,Python,Linux,Python 2.7,Pip,Tensorflow,我正在尝试使用以下命令在本地目录中安装TensorFlow export TF_BINARY_URL=http://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl pip install --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL 我得到以下错误: IOError: [Er

我正在尝试使用以下命令在本地目录中安装TensorFlow

export TF_BINARY_URL=http://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl
pip install --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
我得到以下错误:

IOError: [Errno 28] No space left on device
然后我做了
df
以查看以下内容:

Filesystem             1K-blocks       Used   Available Use% Mounted on
tmpfs                      10240      10240           0 100% /tmp
tmpfs                      10240      10240           0 100% /var/tmp

有没有一种方法可以不在
/tmp
/var/tmp
中下载临时文件的情况下安装TF?谢谢。

您可以使用“pip install-b/some/other/dir”来更改构建目录

您还可以更改车轮方向,如图所示

运行
pip-help-install
也将获得其他dir选项

-b, --build <dir>           Directory to unpack packages into and build in.
-t, --target <dir>          Install packages into <dir>. By default this will not replace existing files/folders in <dir>. Use --upgrade to replace existing packages in <dir> with new versions.
-d, --download <dir>        Download packages into <dir> instead of installing them, regardless of what is already installed.
--src <dir>                 Directory to check out editable projects into. The default in a virtualenv is "<venv path>/src". The default for global installs is "<current dir>/src".
-b,--build目录,用于将包解压缩到其中并内置。
-t、 --目标将软件包安装到。默认情况下,这不会替换中的现有文件/文件夹。使用--upgrade以新版本替换中的现有软件包。
-d、 --将下载包下载到中,而不是安装它们,无论已经安装了什么。
--将可编辑项目签出到的src目录。virtualenv中的默认值为“/src”。全局安装的默认值为“/src”。

通常,您可以将环境变量“TMPDIR”设置为使用不同于/tmp或/var/tmp的目录,大多数程序都会遵守这一点

你也许可以试试

$export TMPDIR=$HOME/tmp


然后启动“pip安装”

在/home/myuser上创建tmp文件夹,然后在终端“export TMPDIR=/home/$USER/tmp”中执行

为什么 由于某种原因,/tmp目录可能没有足够的空间

在pip安装期间,pip将使用/tmp目录执行执行安装所需的操作(例如下载源代码等)

因此,如果您在/tmp中没有安装包所需的足够空间,那么您将得到磁盘空间错误


您可以使用下面的命令配置/tmp目录位置。

解决方案1: Pip不会在此解决方案中重新下载包,但在其他解决方案中会重新下载

使用
df-h
检查可用磁盘空间:

如果您只需要更改tmpfs大小,可以使用新大小在线重新安装:

$ sudo mount -o remount,size=10G /tmp
$ sudo mount -o remount,size=10G /var/tmp
解决方案2: 您可以为pip设置环境变量“TMPDIR”

$ export TMPDIR=$HOME/new/tmp/dir
$ pip install --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
解决方案3: 使用自定义缓存/临时目录

$ pip install --cache-dir=$HOME/new/tmp/dir/  --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
pip install --no-cache-dir --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
解决方案4: 没有缓存目录

$ pip install --cache-dir=$HOME/new/tmp/dir/  --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
pip install --no-cache-dir --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL

非常好的建议,并且易于使用。我进一步建议您更像这样运行它:
TMPDIR=tmp pip install
,因为您以后可能会忘记导出,如果在同一个shell中。请确保文件夹:
mkdir-p$TMPDIR
不这样做会给我带来问题。-b--build已被弃用,并且在设置--build标志时仍在TMPDIR中编译C文件。设置“TMPDIR”对我来说很管用。实际上这一个帮助更大