最近安装了下google native client sdk,安装包里面有python,安装好,运行python,出现如下错误:
C:\Users\Administrator>python
'import site' failed; use -v for traceback
Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>>
这个问题弄的我很不爽,pydev也运行出错,只好在将python lib目录下的文件打包成python26.zip,这样可以运行python了,但是site-packages目录的类都无法
导入,真是无语。今天在网上闲逛时看到了PYTHONHOME这个环境变量,测试下,发现它指向的并不是我的python目录,修改下就OK了
C:\Users\Administrator>echo %PYTHONHOME%
D:\program\python\python2.6\
C:\Users\Administrator>python
Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'D:\\program\\python\\python2.6\\lib\\site-packages\\web.py-0.34-py2.6.egg'
, 'D:\\program\\python\\python2.6\\lib\\site-packages\\flup-1.0.3.dev_20100221-p
y2.6.egg', 'D:\\program\\python\\python2.6\\lib\\site-packages\\cherrypy-3.1.2-p
y2.6-win32.egg', 'D:\\program\\python\\python2.6\\lib\\site-packages\\jinja2-2.4
.1-py2.6.egg'...]