问题

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 fine.

回答1:

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.

回答2:

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

回答3:

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

回答4:

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

回答5:

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

回答6:

I am using VS code and I just noticed this issue today. Google a little and I comment out all the print function still not working. I exit the vs code and launch it again and it works just perfectly.

来源:https://stackoverflow.com/questions/16983673/unable-to-initialize-device-prn-in-python

python 无法初始化设备prn_Unable to initialize device PRN in Python相关推荐

  1. python无法初始化设备_【无法初始化这个硬件设备驱动程序】无法初始化这个硬件的设备驱动_无法初始化d3d...

    2017-08-25 16:30:37 在安装驱动的过程中也会出现很多问题,有的win7用户在安装驱动失败后,在设备管理器中有个硬件前有感叹号,打开属性一看,显示"Windows无法初始化这 ...

  2. python 无法初始化设备prn_彻底搞懂Python一切皆对象,面试必过

    犹记得当初学习Python的时候,对于Python一切皆对象很是懵逼,因为Python是面向对象的动态型语言,而在函数及高阶函数的应用中,如若对于一切皆对象不是有很透彻的了解,基础不是那么牢固的话,那 ...

  3. python无法初始化设备_无法初始化图形设备什么意思

    大家好,我是时间财富网智能客服时间君,上述问题将由我为大家进行解答. 无法初始化图形设备的意思是系统没打开应用程序兼容性,导致无法进行初始化.另外建议参考下程序对配置的要求或者可以更换个版本试试. 操 ...

  4. Python~无法初始化设备 PRN

    1. 报错截图 2. 报错原因 运行Python代码之前没有启动python解释器 3. 解决方法 先执行python解释器,再执行python代码

  5. python vector 初始化_从零开始搭建机器学习算法框架(python)--计算框架

    介绍 今天开始一个新的系列,这个系列的目标是用python在不使用任何第三方库的情况下去实现各类机器学习或者深度学习的算法.之所以会有这种想法是因为每当我想提高编程技巧的时候,我总希望能够做一些简单又 ...

  6. 第五章--设备内容(The Device Context)(2)

    设备的大小 假定要绘制边长为1英寸的正方形,您(程序写作者)或Windows(操作系统)需要知道视讯显示上1英寸对应多少图素.使用GetDeviceCaps函数能取得有关如视讯显示器和打印机之类输出设 ...

  7. 爆肝一周,用Python在物联网设备上写了个智能语音助手

    1. 背景介绍 智能语音助手作为物联网领域的一个重要生态成员,是一种全新的交互方式,它能够解放双手,随时提供服务,无须借助任何按键.想必很多开发者都有玩过天猫精灵.小爱同学或者小度吧,看到这些炫酷的人 ...

  8. 基于Python的IT设备管理系统

    基于Python的IT设备管理系统 近年来,越来越多的企事业单位把业务迁移到Web上完成,随之而来的是数据量的爆炸式增长.数据信息的繁杂,必然要求一个有序的管理系统,而数据库则是管理大量信息最有效的方 ...

  9. 无法初始化设备 prn

    在pycharm里面的local输入python代码提示无法初始化设备prn,这是因为你没有进入到python环境中,先输入python回车,然后就可以正常输出了,跟cmd是一样的

最新文章

  1. 数据库分页存储过程(4)
  2. HTML基础-第二讲
  3. 关于linux LVM
  4. week7 read
  5. 景驰科技与联通实现全国首个5G网络下L4级无人驾驶应用
  6. 【ERNIE】深度剖析知识增强语义表示模型——ERNIE
  7. 《那些年啊,那些事——一个程序员的奋斗史》——06
  8. 如何在jdk官网下载想要的版本
  9. 小米笔记本bios版本大全_RedmiBook 14笔记本评测:初来乍到却熟路轻辙
  10. Thingworx 调用外部接口
  11. 扣图神器, 用Python 5行代码解决
  12. Kali Linux 安装教程和使用技巧
  13. TK 设置tkinter窗口的置顶属性,保持最上层
  14. 设置双击JAD文件打开的模拟器
  15. 这么多的面试题目,总有一个你会在面试中碰到
  16. MFC Windows 程序设计[325]之表格控件例程(附源码)
  17. safari下载文件后缀多添加了.exe的解决方法
  18. EndnoteX9简要使用指南
  19. ICLR 2023 | PatchDCT: 开启精细化实例分割新篇章!
  20. TWaver可视化编辑器(二)3D编辑器

热门文章

  1. 网络编程技术——Web系统构成与工作原理
  2. F5 Networks任命Adam Judd领导亚太区销售工作 将加速区域云和安全业务发展
  3. 实例3:python 删除excel中的多余列
  4. 公钥私钥加密和SHA256
  5. 未来十年最后一次的财富周期(上)
  6. STM32Cube的FATFS+SD卡
  7. 【计算机操作系统】- 【考研复试面试题】-汇总大合集
  8. python人工智能教程——虚拟环境以及包的管理
  9. 旅游路线的查询的测试用例(全)
  10. 《统计学》 贾俊平 第四章 数据的概括性度量 学习总结