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 >>>
  • 相关阅读:
    iOS 倒计时及获取本时区时间
    文字上的删除线
    ios 预览文件-QLPreviewController用法
    iOS delegate、notification、KVO的区别
    mvc 详解
    app切图暂时没有iOS8的,后续继续添加
    背影图
    字体渐变
    ios for 循环 创建 九宫格
    Spherical Harmonics Lighting
  • 原文地址:https://www.cnblogs.com/-sunshine/p/5281034.html
Copyright © 2011-2022 走看看