首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PyCharm调试器- ImportError:无法导入名称getargspec

PyCharm调试器- ImportError:无法导入名称getargspec
EN

Stack Overflow用户
提问于 2020-01-07 06:17:00
回答 1查看 1.2K关注 0票数 0

当我运行PyCharm调试器来调试python代码时,我得到以下错误消息。测试本身在PyCharm和PyCharm之外都运行得很好。我使用的是一个virtualenv,之前我已经多次使用过它了,但这是一个较新的设置,使用的是不同版本的PyCharm、Ubuntu和Python

版本信息:

Python 2.7.17 PyCharm 2019.3.1 (社区版) Build #PC-193.5662.61,构建于2019年12月18日运行时版本: 11.0.5+10-b520.17 amd64 VM: OpenJDK 64位服务器VM,由JetBrains s.r.o Linux 5.3.0-24-generic GC: ParNew,ConcurrentMarkSweep Memory: 7.25M内核:8注册表:非捆绑插件:

没有可用的LSB模块。分销商ID: Ubuntu描述: Ubuntu 19.10版本: 19.10代号: eoan (venv) jnmcclai@jnmccl

代码语言:javascript
复制
/home/jnmcclai/workspace/adtn_1u_olt/venv/bin/python /snap/pycharm-community/172/plugins/python-ce/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 45823 --file /snap/pycharm-community/172/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py --path /home/jnmcclai/workspace/adtn_1u_olt/test/test_basic_plugin.py
Traceback (most recent call last):
  File "/snap/pycharm-community/172/plugins/python-ce/helpers/pydev/pydevd.py", line 37, in <module>
    from _pydevd_bundle.pydevd_comm import CMD_SET_BREAK, CMD_SET_NEXT_STATEMENT, CMD_STEP_INTO, CMD_STEP_OVER, \
  File "/snap/pycharm-community/172/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 91, in <module>
    from _pydevd_bundle import pydevd_console_integration
  File "/snap/pycharm-community/172/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_console_integration.py", line 14, in <module>
    from _pydev_bundle.pydev_code_executor import BaseCodeExecutor
  File "/snap/pycharm-community/172/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_code_executor.py", line 4, in <module>
    from _pydev_bundle._pydev_calltip_util import get_description
  File "/snap/pycharm-community/172/plugins/python-ce/helpers/pydev/_pydev_bundle/_pydev_calltip_util.py", line 20, in <module>
    from _pydev_bundle._pydev_imports_tipper import signature_from_docstring
  File "/snap/pycharm-community/172/plugins/python-ce/helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py", line 9, in <module>
    from inspect import getargspec as _originalgetargspec
ImportError: cannot import name getargspec

Process finished with exit code 1

Empty suite

Empty suite
EN

回答 1

Stack Overflow用户

发布于 2020-01-14 01:59:09

好吧,我能绕过这个……

我必须在PyCharm运行/调试配置中配置working directory路径。执行此操作后,使用调试器时不会出现getargspect错误。下面是运行/调试配置示例。

此外,我们还有一个pytest.ini文件,它添加了运行代码覆盖率的选项。这会导致与PyCharm的调试器发生冲突,并导致调试器无法在断点处“中断”。因此,我必须从pytest.ini文件中删除此行,以便调试器在断点处中断。

代码语言:javascript
复制
addopts = --cov=mcp_general --cov-append --cov-report= --cov-config=.coveragerc
          --doctest-modules -vv --junit-xml .coverage-dir/junit-results.xml
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59619730

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档