繁体   English   中英

使 python 模块适用于 Ubuntu 18.04 中的不同用户 [重复]

[英]making python module work for different users in Ubuntu 18.04 [duplicate]

我的 ubuntu 中有两个用户:anubhav 和 ggc_user。

我使用 pip 安装了 python 模块 dlr。 当我切换到用户 anubhav 并导入 dlr 时,我得到预期的 output:

anubhav@Surface-Pro-3:/usr/bin$ python3
Python 3.7.5 (default, Nov  7 2019, 10:50:52) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlr

CALL HOME FEATURE ENABLED

但是当我使用sudo -u ggc_user切换到 ggc_user 时,导入 dlr 时出现错误:

anubhav@Surface-Pro-3:/usr/bin$ sudo -u ggc_user bash
ggc_user@Surface-Pro-3:/usr/bin$ python3
Python 3.7.5 (default, Nov  7 2019, 10:50:52) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlr
/usr/lib/python3/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.26.3) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)

如何使模块对两个用户都有效?

你可以试试--system arg

sudo python3.7 -m pip install X --system

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM