【发布时间】:2013-06-19 23:10:41
【问题描述】:
我正在尝试安装 python。或者实际上,现在已经安装和卸载了几次。我正在将 pythonxy 与 spyder IDE 一起使用(我习惯于 matlab 是我想使用 spyder 的原因)。在我的 win8 机器上,3.3.2 python 甚至不会以 spyder 启动,所以现在我安装了 2.7 版本。
Spyder 现在启动了,但启动时出现“import sitecustomize”失败?在我的控制台中,python 不会执行我输入的任何命令。出现错误后,启动脚本会一直运行下去而没有做任何事情,我也不能再做任何事情了。错误告诉我用 -v 附录启动 python,输出如下。
我用谷歌搜索了这个错误,这给了我两种可能的解决方案: 我应该编辑 python.rb https://github.com/mxcl/homebrew/commit/10ba101c323f98118b427f291e15abc5b3732991 或者我应该将这个(最后一篇文章中的附件)应用到 sitecustomize https://code.google.com/p/spyderlib/issues/detail?id=771
应用 diff 文件没有帮助,正如 mata 在下面解释的那样,在安装过程中使用了 .rb 文件,因此不适用于我的问题。
所以我的问题是:有人知道如何根据经验修复这个错误吗?
错误:
'import sitecustomize' failed; use -v for traceback
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
回溯:
C:\Python27\lib\site-packages\spyderlib\pil_patch.pyc matches C:\Python27\lib\site-packages\spyderlib\pil_patch.py
import spyderlib.pil_patch # precompiled from C:\Python27\lib\site-packages\spyderlib\pil_patch.pyc
Traceback (most recent call last):
File "C:\Python27\lib\site.py", line 498, in execsitecustomize
import sitecustomize
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 174, in <module>
os.environ["SPYDER_AR_STATE"].lower() == "true")
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\monitor.py", line 146, in __init__
self.n_request.connect( (host, notification_port) )
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 10061] No connection could be made because the target machine actively refused it
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
【问题讨论】:
-
python.rb是一个 ruby 脚本,它告诉自制软件在安装 python 时要做什么,所以这不适用于你。您获得的完整堆栈跟踪是什么,以及您的 sitecustomize.py 中的内容是什么?python -v的输出也可以帮助... -
当我在 command.com 中运行 python -v 时,它不会显示错误,当我尝试运行 spyder -v(例如在链接文件中添加 -v)时,它根本不会启动
-
我现在在 pythonshell 中添加了 -v 参数并获得了“回溯”
-
啊,所以问题只出在 spyder 中的 pythonshell 小部件中,而不是在运行普通的 pyhton 解释器时。似乎它试图创建一些用于监控的网络连接。也许有防火墙阻止了连接?
-
我按照carlos的说明检查了,但是127.0.0.1没有限制
标签: python installation spyder