gpt4 book ai didi

python - 在共享 Web 服务器上安装 Flask 时只读文件系统。任何解决方法?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:46:34 24 4
gpt4 key购买 nike

我在 bigrock 上购买了域名和共享服务器 (linux)。我已经使用 Flask 在我的本地机器上构建了一个服务器,我希望将它作为 CGI 部署在共享服务器上。但是,我无法在共享服务器上安装 Flask。

关于下载 Flask 并在 flask 目录中运行以下命令:

python setup.py install

我收到以下错误:

running install

error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 30] Read-only file system: '/usr/lib/python2.6/site-packages/test-easy-install-655838.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/usr/lib/python2.6/site-packages/

Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
http://peak.telecommunity.com/EasyInstall.html
Please make the appropriate changes for your system and try again.

然后我试试,

sudo python setup.py install

得到如下输出:

-bash:sudo:找不到命令

然后我试试,

apt-get install sudo

得到如下输出:

-bash:apt-get:找不到命令

那么如何在这个网络服务器上安装 flask 呢? Web 服务器中提到了对 python 的支持,我可以使用 ssh 访问。

最佳答案

系统基本上告诉您的是,您无权在系统范围的目录中安装东西(这在共享主机上是预期的)。

您有 2 种可能的方法:

  • 请系统管理员/支持人员在全局安装所有需要的依赖项(这很可能不会发生)
  • 要求 box/support 的系统管理员安装 python-virtualenv,这样你就有了一个隔离的环境来安装你的 flask 副本(如果主机宣传支持 python,你完全有可能有 virtualenv 可用。

同时检查:https://pypi.python.org/pypi/virtualenv

关于python - 在共享 Web 服务器上安装 Flask 时只读文件系统。任何解决方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36499713/

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