用的pytone3.8,很久没有搞python了,用vscode运行以前的py代码居然报错:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Python\Python38-32\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files (x86)\Python\Python38-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\zw\.vscode\extensions\ms-python.python-2020.2.64397\pythonFiles\lib\python\new_ptvsd\no_wheels\ptvsd\__main__.py", line 45, in <module>
    cli.main()
  File "c:\Users\zw\.vscode\extensions\ms-python.python-2020.2.64397\pythonFiles\lib\python\new_ptvsd\no_wheels\ptvsd/..\ptvsd\server\cli.py", line 361, in main
    run()
  File "c:\Users\zw\.vscode\extensions\ms-python.python-2020.2.64397\pythonFiles\lib\python\new_ptvsd\no_wheels\ptvsd/..\ptvsd\server\cli.py", line 203, in run_file
  File "C:\Program Files (x86)\Python\Python38-32\lib\runpy.py", line 262, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\Program Files (x86)\Python\Python38-32\lib\runpy.py", line 95, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Program Files (x86)\Python\Python38-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "e:\pythonCode\checkUrl.py", line 1, in <module>
    import test1.myHttp as my
ModuleNotFoundError: No module named 'test1'

解决办法

管理员身份运行cmd

使用命令:  pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz

再执行:python -m pip install --upgrade pip

再运行代码就可以了

相关文章:

  • 2021-05-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
  • 2021-08-04
  • 2021-12-07
猜你喜欢
  • 2022-02-10
  • 2022-12-23
  • 2021-09-16
  • 2021-07-04
  • 2021-05-02
  • 2021-12-14
相关资源
相似解决方案