Eclipse、PyDev 和 Python 配置错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10195111/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse, PyDev and Python configuration error
提问by JNat
I decided to try to work with Eclipse and PyDev instead of IDLE. I successfully "installed" Eclipse SDK 3.7. After that, I followed the steps displayed on the PyDev website and successfully installed the plugin. However, when trying to configure my interpreter (Python 3.2.3), I always get an error, and don't know how to fix this. I cannot configure it neither automatically nor manually, and there is no reference to this error on the PyDev website.
我决定尝试使用 Eclipse 和 PyDev 而不是 IDLE。我成功“安装”了 Eclipse SDK 3.7。之后,我按照PyDev网站上显示的步骤,成功安装了插件。但是,在尝试配置我的解释器 (Python 3.2.3) 时,我总是收到错误消息,并且不知道如何解决此问题。我既不能自动也不能手动配置它,而且 PyDev 网站上没有提到这个错误。
When trying to configure it automatically, the message displayed is:
尝试自动配置时,显示的消息是:
Unable to gather the needed info from the system.
This usually means that your interpreter is not in the system PATH.
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence.
When I try to configure it manually, the message displayed is the same, adding that some common causes for this problem may be incompatible versions. I have the latest Java (which is one of the requirements, Eclipse was downloaded just yesterday from their site and is 3.7 version (Indigo), and Python is version 3.2.3.
当我尝试手动配置它时,显示的消息是相同的,并补充说此问题的一些常见原因可能是版本不兼容。我有最新的 Java(这是要求之一,Eclipse 是昨天从他们的网站下载的,是 3.7 版(Indigo),Python 是 3.2.3 版。
I even tried to add a folder containing the libraries, because, from what I understand, this would also do the trick. However, whenever I click the New Folder
button, it does nothing...
我什至尝试添加一个包含库的文件夹,因为据我所知,这也可以解决问题。但是,每当我单击New Folder
按钮时,它什么都不做...
I am running all this on Windows 7 32-bit.
我在 Windows 7 32 位上运行所有这些。
If anyone can help me in this matter, I would be very grateful.
如果有人能在这件事上帮助我,我将不胜感激。
Thank you
谢谢
> **@Fabio Zadrozny:**
>
> 1: The path to the Python interpreter is C:\Python32\python.exe
>
> 2: The message displayed when I ran the
> interpreterInfo.py was:
>
> C:\Windows\system32>python
> C:\eclipse-SDK-3.7-win32\eclipse\plugins\org.python.p
> ydev_2.6.0.2012041219\PySrc\interpreterInfo.py
>
> <xml>
> <version>3.2</version> <executable>C:\Python32\python.exe</executable>
> <lib
> path="out">C:\eclipse-SDK-3.7-win32\eclipse\plugins\org.python.pydev_2.6.0.
> 2012041219\PySrc</lib> <lib path="ins">C:\Python32\MóDULOS</lib> <lib
> path="out">C:\Windows\system32\python32.zip</lib> <lib
> path="ins">C:\Python32\DLLs</lib> <lib
> path="ins">C:\Python32\lib</lib> <lib path="ins">C:\Python32</lib>
> <lib path="ins">C:\Python32\lib\site-packages</lib>
> <forced_lib>__main__</forced_lib> <forced_lib>_ast</forced_lib>
> <forced_lib>_bisect</forced_lib> <forced_lib>_codecs</forced_lib>
> <forced_lib>_codecs_cn</forced_lib>
> <forced_lib>_codecs_hk</forced_lib>
> <forced_lib>_codecs_iso2022</forced_lib>
> <forced_lib>_codecs_jp</forced_lib>
> <forced_lib>_codecs_kr</forced_lib>
> <forced_lib>_codecs_tw</forced_lib>
> <forced_lib>_collections</forced_lib> <forced_lib>_csv</forced_lib>
> <forced_lib>_datetime</forced_lib> <forced_lib>_functools</forced_lib>
> <forced_lib>_heapq</forced_lib> <forced_lib>_io</forced_lib>
> <forced_lib>_json</forced_lib> <forced_lib>_locale</forced_lib>
> <forced_lib>_lsprof</forced_lib> <forced_lib>_md5</forced_lib>
> <forced_lib>_multibytecodec</forced_lib>
> <forced_lib>_pickle</forced_lib> <forced_lib>_random</forced_lib>
> <forced_lib>_sha1</forced_lib> <forced_lib>_sha256</forced_lib>
> <forced_lib>_sha512</forced_lib> <forced_lib>_sre</forced_lib>
> <forced_lib>_string</forced_lib> <forced_lib>_struct</forced_lib>
> <forced_lib>_subprocess</forced_lib>
> <forced_lib>_symtable</forced_lib> <forced_lib>_thread</forced_lib>
> <forced_lib>_warnings</forced_lib> <forced_lib>_weakref</forced_lib>
> <forced_lib>array</forced_lib> <forced_lib>atexit</forced_lib>
> <forced_lib>audioop</forced_lib> <forced_lib>binascii</forced_lib>
> <forced_lib>builtins</forced_lib> <forced_lib>cmath</forced_lib>
> <forced_lib>errno</forced_lib> <forced_lib>gc</forced_lib>
> <forced_lib>imp</forced_lib> <forced_lib>itertools</forced_lib>
> <forced_lib>marshal</forced_lib> <forced_lib>math</forced_lib>
> <forced_lib>mmap</forced_lib> <forced_lib>msvcrt</forced_lib>
> <forced_lib>nt</forced_lib> <forced_lib>operator</forced_lib>
> <forced_lib>parser</forced_lib> <forced_lib>signal</forced_lib>
> <forced_lib>sys</forced_lib> <forced_lib>time</forced_lib>
> <forced_lib>winreg</forced_lib> <forced_lib>xxsubtype</forced_lib>
> <forced_lib>zipimport</forced_lib> <forced_lib>zlib</forced_lib>
> </xml>Traceback (most recent call last): File
> "C:\eclipse-SDK-3.7-win32\eclipse\plugins\org.python.pydev_2.6.0.20120412
> 19\PySrc\interpreterInfo.py", line 142, in <module>
> raise RuntimeError('Ok, this is so that it shows the output (ugly hack for s ome platforms, so that it releases the output).')
> RuntimeError: Ok, this is so that it shows the output (ugly hack for
> some platfo rms, so that it releases the output).
Thank you for your help! And sorry for the formatting.
感谢您的帮助!抱歉格式化。
采纳答案by Fabio Zadrozny
Edit 2:
编辑2:
This issue has just been fixed (and a nightly build has been deployed with the fix). This will be available on PyDev 2.6.0
这个问题刚刚被修复(并且已经部署了一个带有修复的夜间构建)。这将在 PyDev 2.6.0 上可用
Edit:
编辑:
The issue seems to be a unicode issue because of C:\Python32\MóDULOS. I'll try to fix that tomorrow, in the meanwhile, you can remove the unicode chars from your PYTHONPATH to make things work...
由于 C:\Python32\MóDULOS,该问题似乎是 unicode 问题。明天我会尝试解决这个问题,同时,您可以从 PYTHONPATH 中删除 unicode 字符以使事情正常进行...
To properly diagnose it, please do the following:
要正确诊断,请执行以下操作:
Go to window > preferences > pydev > interpreter - python and choose the 'new' option to point to the actual python executable (I think you already did that, but just to make sure it's not only an issue in the auto config).
转到窗口 > 首选项 > pydev > 解释器 - python 并选择“新”选项以指向实际的 python 可执行文件(我认为您已经这样做了,但只是为了确保它不仅仅是自动配置中的问题)。
If the issue above doesn't solve it, I believe it may be unicode issue, so, to be able to help you, please follow the steps below:
如果上述问题没有解决,我认为可能是unicode问题,所以,为了能够帮助您,请按照以下步骤操作:
Post your path to the Python interpreter you're configuring.
Run: python c:\eclipse\plugins\org.python.pydev_XXX\pysrc\interpreterInfo.py and paste the output you have.
(make sure that 'python' is the python you're configuring and the path from the plugin points to the proper location).
If you have some unicode char in the path to your python interpreter, try installing python to some place where you don't have unicode chars (if this solves your issue, I'll take care of making it work with your configuration, but I'll probably only be able to tackle this on Thursday -- but it'll be really high-priority in my todo-list).
将您的路径发布到您正在配置的 Python 解释器。
运行: python c:\eclipse\plugins\org.python.pydev_XXX\pysrc\interpreterInfo.py 并粘贴您的输出。
(确保“python”是您正在配置的python,并且从插件到正确位置的路径)。
如果您的 python 解释器的路径中有一些 unicode 字符,请尝试将 python 安装到您没有 unicode 字符的某个地方(如果这解决了您的问题,我将负责使其与您的配置一起使用,但我' 可能只能在周四解决这个问题——但它在我的待办事项列表中将是非常重要的)。