例如:import pkg_resources失败
可以print sys.path查看,从其他机器上cp -r过来即可,如下例子:
从另外一个正常的机器上scp过来/usr/ali/lib/python2.5/site-packages目录。
1 $python 2 Python 2.5.4 (r254:67916, May 31 2010, 15:03:39) 3 [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 4 Type "help", "copyright", "credits" or "license" for more information. 5 >>> import pkg_resources 6 Traceback (most recent call last): 7 File "<stdin>", line 1, in <module> 8 ImportError: No module named pkg_resources 9 >>> 10 11 [admin@rs1c07296 /home/admin/wenwen] 12 $python 13 Python 2.5.4 (r254:67916, May 31 2010, 15:03:39) 14 [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 15 Type "help", "copyright", "credits" or "license" for more information. 16 >>> import sys; 17 >>> print sys.path 18 ['', '/usr/ali/lib/python25.zip', '/usr/ali/lib/python2.5', '/usr/ali/lib/python2.5/plat-linux2', '/usr/ali/lib/python2.5/lib-tk', '/usr/ali/lib/python2.5/lib-dynload', '/usr/ali/lib/python2.5/site-packages'] 19 >>>