在 eclipse Pydev 控制台和 Idle 中打印 Unicode
我的配置:Win7 + Python 2.6 + eclipse + PyDev
如何
- 在 eclipse 中的 PyDev 控制台
- 中启用 Unicode 打印语句空闲 Python GUI
打印语句示例:
print(u"שלום עולם")
输出为:
ùìåí òåìí
My configuration: Win7 + Python 2.6 + eclipse + PyDev
How do I enable Unicode print statements in:
- PyDev console in eclipse
- Idle Python GUI
Example print statement:
print(u"שלום עולם")
This comes out as:
ùìåí òåìí
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在 Eclipse Luna 中遇到同样的问题 4.0.4 与 Python 3.4.1 和 PyDev 3.6.0。我尝试了上面给出的步骤以及其他一些步骤,但毫无进展。
对我有用的是 Eclipse 中的首选项 -> PyDev —> 口译员 -> Python解释器,在环境选项卡中,我添加了环境变量PYTHONIOENCODING,并将其值指定为utf-8 。
这对我来说很有效……
I was having the a same problem in Eclipse Luna 4.0.4 with Python 3.4.1 and PyDev 3.6.0. I tried the steps given above, and a few others, and was getting nowhere.
What worked for me was, in Eclipse, in Preferences —> PyDev —> Interpreters —> Python Interpreter, in the Environment tab, I added the environment variable PYTHONIOENCODING and specified its value as utf-8.
That did the trick for me…
PYTHONIOENCODING 是解决此问题的一种非常好的通用方法。然而,Eclipse 设置其控制台区域设置的方式如下:
设置运行配置编码:
PYTHONIOENCODING is a pretty good generic way of fixing this problem. However, the Eclipse way of setting the locale of its console is as follows:
Set the Run Configuration encoding:
对于 eclipse unicode 控制台支持:
-Dfile.encoding=UTF-8
添加到 eclipse 安装目录中的eclipse.ini
中。Run\Run Configurations\Python Run\configuration\Common\
确保选择了 UTF-8Window\Preferences\General\Workspace\Text file encoding\
> 确保[python 安装路径]\Lib\site.py
中选择 UTF-8 - 从encoding = "ascii"
更改为encoding = "utf -8"
Window\Preferences\Appearance\Colors and Fonts\Debug\Console font\Edit
在安装中我做了所有的上面:
对于 django 模型:
For eclipse unicode console support:
-Dfile.encoding=UTF-8
toeclipse.ini
which is in the eclipse install directory.Run\Run Configurations\Python Run\configuration\Common\
make sure UTF-8 is selectedWindow\Preferences\General\Workspace\Text file encoding\
making sure UTF-8 is selected[python install path]\Lib\site.py
- change fromencoding = "ascii"
toencoding = "utf-8"
Window\Preferences\Appearance\Colors and Fonts\Debug\Console font\Edit
In the installation I did all of the above:
For django models: