python3-dbg 无法导入 setproctitle

python3-dbg 无法导入 setproctitle

import setproctitle使用python3有效,但使用python3-dbg失败。我怎样才能解决这个问题?

$ cat test.py
from setproctitle import setproctitle
setproctitle('test')
$ python3 ./test.py
$ python3-dbg ./test.py
Traceback (most recent call last):
  File "./test.py", line 2, in <module>
    from setproctitle import setproctitle
ImportError: No module named 'setproctitle'

我使用 在此 Ubuntu 14.04 系统上安装了 setproctitle sudo pip3 install setproctitle。我知道一个 ubuntu 软件包setproctitle-dbg,但似乎没有与此等效的 python3:

$ sudo pip3 install --upgrade setproctitle-dbg
Downloading/unpacking setproctitle-dbg
  Could not find any downloads that satisfy the requirement setproctitle-dbg
Cleaning up...
No distributions at all found for setproctitle-dbg
Storing debug log for failure in /home/oleg/.pip/pip.log

sys.path的输出完全匹配,其他导入似乎工作正常。python3-dbgpython3

答案1

我通过python3-setproctitle-dbg从源安装解决了这个问题。

  1. 下载并提取源代码https://launchpad.net/ubuntu/+source/python-setproctitle/1.1.8-1

  2. CD 到该目录并使用以下命令构建它sudo make build PYTHON=python3-dbg PYCONFIG=python3-dbg-config

  3. 复制./build/lib.3/setproctitle.cpython-34dm.so/usr/lib/python3/dist-packages/并设置适当的权限

相关内容