启动spyder后,“导入sitecustomize"失败 [英] 'import sitecustomize' failed upon starting spyder

查看:324
本文介绍了启动spyder后,“导入sitecustomize"失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装python.或者实际上,已经安装并卸载了几次.我在spyder IDE中使用pythonxy(我习惯于matlab,这就是为什么我想使用spyder的原因). 3.3.2 python甚至不会在win8机器上以spyder开头,所以现在我安装了2.7版本.

I am trying to install python. Or actually, have installed and deinstalled it a few times now. I am using pythonxy with the spyder IDE (i am used to matlab is why i want to use spyder). The 3.3.2 python would not even start with spyder on my win8 machine, so now I have the 2.7 version installed.

Spyder现在启动了,但是启动后我得到的'import sitecustomize'失败了吗?在我的控制台和python中不会执行我输入的任何命令.错误发生后,startupscript会一直持续进行,而无需执行任何操作,我也无法执行任何操作.该错误告诉我使用-v附录启动python,输出如下.

Spyder starts up now, but upon startup I get `'import sitecustomize' failed? in my console and python wont execute any commands I enter. After the error the startupscript keeps on going forever without doing anything and I cant do anything either anymore. The error tells me to start python with -v appendix, output below.

我用谷歌搜索了这个错误,这给了我两个可能的解决方案: 我应该编辑python.rb > https://github.com/mxcl/homebrew/commit/10ba101c323f98118b427f291e15abc5b3732991 还是我应该将此(附件中最后一篇文章的附件)应用于sitecustomize https://code.google.com/p/spyderlib/issues/detail ?id = 771

I have googled this error which gave me two possible solutions: i should edit python.rb https://github.com/mxcl/homebrew/commit/10ba101c323f98118b427f291e15abc5b3732991 or i should apply this (attachment in last post there) to sitecustomize https://code.google.com/p/spyderlib/issues/detail?id=771

应用差异文件无济于事,正如mata所述,在安装过程中会使用.rb文件,因此不适用于我的问题.

Applying the diff file did not help and as mata explains below the .rb file is used during install, so not applicable to my problem.

所以我的问题是:有人从经验中知道如何解决此错误吗?

So my question: Does anybody know how to fix this bug from experience?

错误:

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

推荐答案

(此处为Spyder dev)我几乎可以确定您的问题是由于防火墙问题引起的.看来您的防火墙太严格了,它阻止了所有尝试为我们目的打开端口的尝试.

(Spyder dev here) I'm almost sure your problem is because of a firewall issue. It seems your firewall is too strict and it's blocking all attempts to try to open a port for our purposes.

为了避免在评估内容时阻塞整个应用程序,我们在运行python解释器的过程与运行Spyder的过程不同.我们使用简单的套接字协议与该进程进行通信,该协议会在您的计算机上打开一个新端口,并通过该端口在控制台和Spyder之间来回发送数据.

To avoid blocking the full application while evaluating stuff, we run our python interpreter on a different process than the one Spyder runs on. We communicate with that process using a simple sockets protocol, which opens a new port on your machine and sends data back and forth between the console and Spyder through that port.

这也是为什么您在常规python解释器上看不到错误的原因:因为它不需要打开端口即可运行.

That's also the reason why you are not seeing the error on a regular python interpreter: because it doesn't need to open a port to run.

这篇关于启动spyder后,“导入sitecustomize"失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆