Debugging
python3-dbg 無法導入 setproctitle
import setproctitle
usingpython3
有效,但 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
從原始碼安裝解決了這個問題。
- 從https://launchpad.net/ubuntu/+source/python-setproctitle/1.1.8-1下載並提取原始碼
- CD 到目錄並使用
sudo make build PYTHON=python3-dbg PYCONFIG=python3-dbg-config
- 複製
./build/lib.3/setproctitle.cpython-34dm.so
到/usr/lib/python3/dist-packages/
並設置適當的權限