在没有gcc或root访问权限的共享主机上安装需要gcc的python模块 [英] installing python modules that require gcc on shared hosting with no gcc or root access

查看:78
本文介绍了在没有gcc或root访问权限的共享主机上安装需要gcc的python模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Hostgator共享用作生产环境,并且在使用以下命令后安装一些python模块时遇到问题:

I'm using Hostgator shared as a production environment and I had a problem installing some python modules, after using:

pip安装MySQL-python

pip install MySQL-python

pip安装枕头

结果:

无法执行gcc:权限被拒绝 错误:命令'gcc'失败,退出状态为1

unable to execute gcc: Permission denied error: command 'gcc' failed with exit status 1

服务器限制

  • 无root访问权限
  • sudo不起作用(sudo:有效uid不为0,sudo是否已安装setuid root?)
  • 没有gcc

问题

  1. 是否有其他枕头包装.我希望它使用django ImageField. (就像pymysql可以替代mysql-python一样)

  1. is there an alternative package for pillow. I want this to use django ImageField. (just like pymysql is an equally capable alternative for mysql-python)

我在根目录中安装了mysql-python和pil之类的模块,即不带任何virtualenv的pip冻结列出了这些模块.但是我无法在此根环境中安装其他必需的模块,也无法在virtualenv中安装mysql-python和pil.可以做些什么吗?我们可以以某种方式在virtualenv中导入/使用安装在根目录下的软件包吗?

i have modules like mysql-python and pil installed in root, i.e. pip freeze without any virtualenv lists these modules. but i cannot install my other required modules in this root environment and in my virtualenv i cannot install mysql-python and pil. can something be done? can we import/use packages installed in root somehow in a virtualenv?

是hostgator共享的,仅对PHP有好处,而对python/django webapps没有好处.我们的流量有限,因此我们正在使用hostgator共享.我们应该避免使用hostgator还是共享托管?它们对于python/django是否还不够好(我在托管静态/PHP网站方面没有任何问题).它们是否有太多的问题,局限性或性能问题(FCGI)?如果是的话,还有哪些替代方案?

is hostgator shared only good for PHP and not for python/django webapps. we have limited traffic so we are using hostgator shared. should we avoid hostgator or shared hosting? aren't they good enough for python/django (i had no problems in hosting static/PHP sites ever). are they too many problems and limitations or performance issues (FCGI)? if yes, what are the alternatives?

推荐答案

您可以尝试构建轮子在一些有gcc可用的类似主机上,将它们复制到您的服务器上并进行安装.但是我不知道应该有多少相似的主机.

You can try building wheels on some similar host where gcc is available, copy them to your server and install. But I do not know how much similar hosts should be.

  1. 在具有gcc的相似"主机上:

  1. on "similar" host with gcc:

mkdir /tmp/wheels mkdir /tmp/pip-cache pip wheel --download-cache /tmp/pip-cache -w /tmp/wheels -r requirements.pip

mkdir /tmp/wheels mkdir /tmp/pip-cache pip wheel --download-cache /tmp/pip-cache -w /tmp/wheels -r requirements.pip

将轮子复制到您的主机(我假设您复制到/tmp/wheels)

copy wheels to your hosting (I assume that you copy to /tmp/wheels)

从车轮安装,忽略索引并使用车轮目录:

install from wheels ignoring index and using wheels dir:

pip install --download-cache /tmp/pip-cache --find-links=/tmp/wheels --no-index -r requirements-dev.pip

P.S.也许您还应该将下载缓存复制到您的托管中.我不记得是否需要这样做.如果不需要,则可以跳过选项--download-cache /tmp/pip-cache

P.S. Maybe you should also copy download-cache to your hosting. I do not remember if this is needed. If this is not needed then you can skip option --download-cache /tmp/pip-cache

这篇关于在没有gcc或root访问权限的共享主机上安装需要gcc的python模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆