python打开文件出错,怎么回事?

ming_311 2015-01-13 05:19:02
我使用eclipse + pydev作为IDE,Python 版本 3.2,打开文件时出错

#coding=gbk
f = open("c:/a", "r")


控制台
NameError: name 'open' is not defined
解释器



怎么回事啊?
...全文
267 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ming_311 2015-01-14
  • 打赏
  • 举报
回复
引用 2 楼 panghuhu250 的回复:
根据这儿的说法(http://pyspanishdoc.sourceforge.net/api/embedding.html) "The basic initialization function is Py_Initialize(). This initializes the table of loaded modules, and creates the fundamental modules __builtin__, __main__ and sys. It also initializes the module search path (sys.path)." open函数是在__builtin__中的. Py_Initialize()出错, 导致open找不到. 检查你的pydev的安装和设置.
TKS
JPF1024 2015-01-13
  • 打赏
  • 举报
回复
其实直接用sublime text3就足够了,python3没遇到过...
panghuhu250 2015-01-13
  • 打赏
  • 举报
回复
根据这儿的说法(http://pyspanishdoc.sourceforge.net/api/embedding.html) "The basic initialization function is Py_Initialize(). This initializes the table of loaded modules, and creates the fundamental modules __builtin__, __main__ and sys. It also initializes the module search path (sys.path)." open函数是在__builtin__中的. Py_Initialize()出错, 导致open找不到. 检查你的pydev的安装和设置.
ming_311 2015-01-13
  • 打赏
  • 举报
回复
控制台还有一个错误 Fatal Python error: Py_Initialize: can't initialize sys standard streams

37,719

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧