如果我想通过“pip install packagename”调试安装的软件包 packagename 的 setup.py 文件,有什么办法吗?我尝试下载源代码,在 setup.py 中添加 set_trace() 并运行:
pip 安装。
但是,当我收到 pdb() 提示时,安装失败并出现错误:
Processing /Users/skauser/python-ibmdb/IBM_DB/ibm_db
Complete output from command python setup.py egg_info:
> /private/var/folders/b6/pmddncpn77550p8_g9kkx9f40000gp/T/pip-req-build-_fg8s5a2/setup.py(31)<module>()
-> machine_bits = 8 * struct.calcsize("P")
(Pdb)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/b6/pmddncpn77550p8_g9kkx9f40000gp/T/pip-req-build-_fg8s5a2/setup.py", line 31, in <module>
machine_bits = 8 * struct.calcsize("P")
File "/private/var/folders/b6/pmddncpn77550p8_g9kkx9f40000gp/T/pip-req-build-_fg8s5a2/setup.py", line 31, in <module>
machine_bits = 8 * struct.calcsize("P")
File "/Library/anaconda3/lib/python3.7/bdb.py", line 88, in trace_dispatch
return self.dispatch_line(frame)
File "/Library/anaconda3/lib/python3.7/bdb.py", line 113, in dispatch_line
if self.quitting: raise BdbQuit
bdb.BdbQuit
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/b6/pmddncpn77550p8_g9kkx9f40000gp/T/pip-req-build-_fg8s5a2/
虽然我可以通过:python setup.py build 调试源代码,但是我想要调试的行为仅适用于通过 pip 安装的情况。
期待您的建议。谢谢!
答案1
这个问题似乎已回答在 Stack Overflow 上,尽管答案尚未被接受。