zoukankan      html  css  js  c++  java
  • python中import失败解决的简单办法

    例如: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 >>>
  • 相关阅读:
    DB2去重的几种方法
    split命令:文件切割
    DB2中横表纵表互换
    做一个思想的码农
    access应用分享
    回顾2015年
    笑看互联网金融
    Razor语法
    数据库操作(二)
    SQL Server数据库简介(一)
  • 原文地址:https://www.cnblogs.com/-sunshine/p/5281034.html
Copyright © 2011-2022 走看看