Unable to initialize device PRN in Python

前端 未结 8 1318
盖世英雄少女心
盖世英雄少女心 2021-02-07 01:22

I attempt to run a python program and the following pops up in command prompt:

\"Unable to initialize device PRN\"

I should also mention that the program runs fi

相关标签:
8条回答
  • 2021-02-07 01:44

    In my case restarting (close / open new) the console or the Command Prompt window works

    0 讨论(0)
  • 2021-02-07 01:45

    Try changing name of the program; that worked for me. Don't forget: use fresh cmd when you start executing.

    0 讨论(0)
  • 2021-02-07 01:51

    First of all install latest version of Python from it's official website (i.e. python.org/download) after that if you try to run it through command prompt instead of writing python3 just write python. After that >> it will appear then start writing your actual code. Make sure you re-run the command prompt window.

    0 讨论(0)
  • 2021-02-07 01:54

    I know this is an old question, but I experienced this issue in VS Code after installing the latest version of Python and the Python extension.

    To fix it, I just needed to add the Python installation path to my PATH environment variable.

    • On Windows 10, go to Settings and search for Environment
    • Click on Edit environment variables for your account
    • Select Path and click the Edit button
    • If the path to your Python.exe is not listed, click the New button
    • Enter the path to your Python.exe application and click the OK button
      • The path for me was %LocalAppData%\Programs\Python\Python37-32\
    • Restart VS Code and try to run your python script again
    0 讨论(0)
  • 2021-02-07 01:55

    I had this same problem when I accidentally typed "print program.py" instead of "python program.py". The error message comes from the Windows command-line program named print. Those who suggested restarting the command prompt probably committed the same typo without noticing, and corrected it in their new command prompt.

    0 讨论(0)
  • 2021-02-07 01:58

    To fix this, add python.exe to system varible in your windows On Windows 10, go to Settings and search for Environment Click on Edit environment variables for your account Select Path and click the Edit button If the path to your Python.exe is not listed, click the New button Enter the path to your Python.exe application and click the OK button and restart the application

    0 讨论(0)
提交回复
热议问题