Debugging

python3-dbg 無法導入 setproctitle

  • November 15, 2014

import setproctitleusingpython3有效,但 usingpython3-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 系統上使用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-dbg``python3

我通過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/並設置適當的權限

引用自:https://unix.stackexchange.com/questions/168068