gpt4 book ai didi

python - 在 Ubuntu 服务器上安装软件包时出现内存不足问题

转载 作者:IT老高 更新时间:2023-10-28 22:10:02 25 4
gpt4 key购买 nike

我正在使用具有有限 512MB 内存和 20GB 硬盘的 Ubuntu 云服务器。它的 450MB+ RAM 已被进程使用。

我需要安装一个名为 lxml 的新软件包,它在安装时使用 Cpython 进行编译,这是一个非常繁重的过程,因此它总是以错误 gcc 退出:内部编译器错误:已终止(程序 cc1),这是由于没有可用的 RAM 运行。

升级机器是一种选择,但它有自己的问题,我的服务/网站很少来自这台服务器本身。

但是在我的本地机器上 lxml 已经正确安装了。而且由于我的需要只是 lxml,所以是否有可能从本地机器的目录中选择所有有用的文件然后复制到远程机器中?

会这样吗?如果是,如何提取一个包的所有文件?

问候

最佳答案

通过添加交换文件来扩展您的 RAM: http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/

a swap file is a file stored on the computer hard drive that is used as a temporary location to store information that is not currently being used by the computer RAM. By using a swap file a computer has the ability to use more memory than what is physically installed in the computer http://www.computerhope.com/jargon/s/swapfile.htm

简而言之:

  1. 以root身份登录:su -或执行前面带有sudo的命令
  2. dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
  3. mkswap/swapfile1
  4. chown root:root/swapfile1
  5. chmod 0600/swapfile1
  6. 交换/swapfile1

现在交换文件将被临时激活,但在重启后将消失。您应该有足够的 RAM 用于安装过程

删除文件:

  1. swapoff -v/swapfile1
  2. rm/swapfile1

关于python - 在 Ubuntu 服务器上安装软件包时出现内存不足问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18334366/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com