【问题标题】:Python module not working when using other account使用其他帐户时Python模块不起作用
【发布时间】:2014-07-27 09:39:16
【问题描述】:

我在 CentOS 中创建了一个名为 nafd_it 的新用户。

然后授予 virtualenv nafd 文件夹的所有权。该文件夹包含 django 应用程序和 python2.7。

sudo chown -R nafd_it /env/nafd
sudo chmod -R g+w /env/nafd

在我的根虚拟环境中,当我启动我的 python2.7 时,我可以导入时间模块。 但是当我改变用户时

su - nafd_it

-bash-4.1$ source bin/activate
(nafd)-bash-4.1$ python

当我发出import time时在python环境中

我来了

ImportError: No module named time

我已经将/env/nafd文件夹的文件夹权限更改为chmod -R ugo+rwx env/nafd

如何让用户 nafd_it 读取 python 模块?

【问题讨论】:

    标签: django python-2.7 centos6


    【解决方案1】:

    在我忘记再次解决这个问题之前,我通过将用户 nafd_it 添加到 root 组来设法通过这个防火墙。

    usermod -a -G root 'nafd_it'

    我现在可以使用 nafd_it 用户正确访问该模块。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-14
      • 2013-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-29
      • 1970-01-01
      相关资源
      最近更新 更多