【发布时间】:2011-09-22 05:14:47
【问题描述】:
我正在使用共享机器。我正在尝试为使用 Pysco 的项目安装 Python 2.6(在 2.7 上不受支持),并且机器上现有的 2.7 安装我无法在不破坏其他人的项目的情况下删除。
我在 Windows 7 上使用 Python 的 32 位二进制文件。
当我尝试启动 Python 2.6 时,出现此错误:
'import-site' failed; use -v for traceback
看起来 Python 2.6 正在尝试从 Python 2.7 导入模块,这导致了失败(请参阅下面的输出)。有谁知道这可能是什么原因,以及如何解决?谢谢!
使用 -v 选项运行会得到以下输出
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# C:\Python27\Lib\site.pyc matches C:\Python27\Lib\site.py
import site # precompiled from C:\Python27\Lib\site.pyc
# C:\Python27\Lib\os.pyc matches C:\Python27\Lib\os.py
import os # precompiled from C:\Python27\Lib\os.pyc
import errno # builtin
import nt # builtin
# C:\Python27\Lib\ntpath.pyc matches C:\Python27\Lib\ntpath.py
import ntpath # precompiled from C:\Python27\Lib\ntpath.pyc
# C:\Python27\Lib\stat.pyc matches C:\Python27\Lib\stat.py
import stat # precompiled from C:\Python27\Lib\stat.pyc
# C:\Python27\Lib\genericpath.pyc matches C:\Python27\Lib\genericpath.py
import genericpath # precompiled from C:\Python27\Lib\genericpath.pyc
# C:\Python27\Lib\warnings.pyc matches C:\Python27\Lib\warnings.py
import warnings # precompiled from C:\Python27\Lib\warnings.pyc
# C:\Python27\Lib\linecache.pyc matches C:\Python27\Lib\linecache.py
import linecache # precompiled from C:\Python27\Lib\linecache.pyc
# C:\Python27\Lib\types.pyc matches C:\Python27\Lib\types.py
import types # precompiled from C:\Python27\Lib\types.pyc
# C:\Python27\Lib\UserDict.pyc matches C:\Python27\Lib\UserDict.py
import UserDict # precompiled from C:\Python27\Lib\UserDict.pyc
# C:\Python27\Lib\_abcoll.pyc matches C:\Python27\Lib\_abcoll.py
import _abcoll # precompiled from C:\Python27\Lib\_abcoll.pyc
# C:\Python27\Lib\abc.pyc matches C:\Python27\Lib\abc.py
import abc # precompiled from C:\Python27\Lib\abc.pyc
# C:\Python27\Lib\_weakrefset.pyc matches C:\Python27\Lib\_weakrefset.py
import _weakrefset # precompiled from C:\Python27\Lib\_weakrefset.pyc
import _weakref # builtin
'import site' failed; traceback:
Traceback (most recent call last):
File "C:\Python27\Lib\site.py", line 62, in <module>
import os
File "C:\Python27\Lib\os.py", line 398, in <module>
import UserDict
File "C:\Python27\Lib\UserDict.py", line 84, in <module>
_abcoll.MutableMapping.register(IterableUserDict)
File "C:\Python27\Lib\abc.py", line 109, in register
if issubclass(subclass, cls):
File "C:\Python27\Lib\abc.py", line 151, in __subclasscheck__
if subclass in cls._abc_cache:
File "C:\Python27\Lib\_weakrefset.py", line 69, in __contains__
return ref(item) in self.data
TypeError: cannot create weak reference to 'classobj' object
【问题讨论】:
标签: python windows windows-7 installation python-2.6