V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yhm2046
V2EX  ›  Java

为什么同一个服务器的不同账户编译会报错?

  •  
  •   yhm2046 · 2022-07-25 15:11:58 +08:00 · 1438 次点击
    这是一个创建于 853 天前的主题,其中的信息可能已经有所发展或是发生改变。

    OS:ubuntu16.04

    同一个服务器,我的账户是 user1,同事是 user2 我使用 python2.7 单编译 mm 命令时候报错:

    Traceback (most recent call last): File "/usr/lib/python3.6/dbm/gnu.py", line 4, in <module> from _gdbm import * ModuleNotFoundError: No module named '_gdbm'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 7, in <module> import dbm.gnu as gdbm File "/usr/lib/python3.6/dbm/gnu.py", line 6, in <module> raise ImportError(str(msg) + ', please install the python3-gdbm package') ImportError: No module named '_gdbm', please install the python3-gdbm package

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/usr/lib/command-not-found", line 27, in <module> from CommandNotFound.util import crash_guard File "/usr/lib/python3/dist-packages/CommandNotFound/init.py", line 3, in <module> from CommandNotFound.CommandNotFound import CommandNotFound File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 9, in <module> import gdbm ModuleNotFoundError: No module named 'gdbm'

    切换 python3.x 也是一样 sudo update-alternatives --config python

    There are 2 choices for the alternative python (providing /usr/bin/python).

    Selection Path Priority Status

    0 /usr/bin/python2 150 auto mode

    • 1 /usr/bin/python2 150 manual mode 2 /usr/bin/python3 100 manual mode

    Press <enter> to keep the current choice[*], or type selection number:

    3 条回复    2022-07-27 09:10:59 +08:00
    SunsetShimmer
        1
    SunsetShimmer  
       2022-07-25 21:00:40 +08:00 via Android
    一个猜想。
    当前用户没安装 gdbm 这个包,但是成功的那个用户安装了? pip 可以把包安装在用户 home 目录下。
    ruanimal
        2
    ruanimal  
       2022-07-26 10:14:44 +08:00
    对比下两个用户的环境变量,问题应该就解决了
    yhm2046
        3
    yhm2046  
    OP
       2022-07-27 09:10:59 +08:00
    我把 gdbm 卸载重新安装, 再打开一个新窗口就行了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5416 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 05:55 · PVG 13:55 · LAX 21:55 · JFK 00:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.