在pycharm上使用pip安装:ValueError:错误的元帅数据(未知类型代码)

时间:2019-01-01 10:03:29

标签: python pip pycharm

我使用Pycharm即时安装了pip安装程序,但出现此错误。我可以得到一些帮助吗?

错误消息: ValueError:编组数据错误(类型代码未知)

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\packaging_tool.py", line 145, in main
    do_install(pkgs)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\packaging_tool.py", line 59, in do_install
    run_pip(['install'] + pkgs)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\packaging_tool.py", line 73, in run_pip
    runpy.run_module(module_name, run_name='__main__', alter_sys=True)
  File "C:\Users\usr\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "C:\Users\usr\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\usr\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\usr\PycharmProjects\Coding\Kidsafe\Prodaction\venv\lib\site-packages\pip\__main__.py", line 16, in <module>
    from pip._internal import main as _main  # isort:skip # noqa
  File "C:\Users\usr\PycharmProjects\Coding\Kidsafe\Prodaction\venv\lib\site-packages\pip\_internal\__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\Users\usr\PycharmProjects\Coding\Kidsafe\Prodaction\venv\lib\site-packages\pip\_internal\cli\autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\Users\usr\PycharmProjects\Coding\Kidsafe\Prodaction\venv\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "C:\Users\usr\PycharmProjects\Coding\Kidsafe\Prodaction\venv\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 16, in <module>
    from pip._internal.exceptions import CommandError
  File "C:\Users\usr\PycharmProjects\Coding\Kidsafe\Prodaction\venv\lib\site-packages\pip\_internal\exceptions.py", line 6, in <module>
    from pip._vendor.six import iteritems
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 724, in exec_module
  File "<frozen importlib._bootstrap_external>", line 857, in get_code
  File "<frozen importlib._bootstrap_external>", line 525, in _compile_bytecode
ValueError: bad marshal data (unknown type code)

1 个答案:

答案 0 :(得分:0)

这似乎是由于我使用 Google-fu 发现的各种来源的*.pyc文件损坏导致的。您可能需要递归地删除已编译的python文件(*.pyc),然后再次尝试。参见HTTP Interceptor