将源添加到PYTHONPATH后找不到Python模块

时间:2016-11-28 01:10:42

标签: python

我试图使用名为imsearchtools

的模块

在目录/imsearch-tools

import imsearchtools工作正常。

在其他地方我收到此错误:

  

ImportError:没有名为imsearchtools的模块

我在第二个答案之后将目录添加到PYTHONPATHPermanently add a directory to PYTHONPATH。这没用。之后,我将模块文件夹的副本添加到usr/local/lib/python2.7/sitepackages/imsearch-tools,因为这是我PYTHONPATH中最初的目录之一。但是,我仍然只能在相应目录中使用import imsearchtools而不能在其他目录中使用。

目前:

>>> import sys

>>> print(sys.path)

['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu',  
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',  
'/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages',  
'/usr/local/lib/python2.7/dist-packages/tornado-4.0.1-py2.7-linux-x86_64.egg',  
'/usr/local/lib/python2.7/dist-packages/backports.ssl_match_hostname-3.4.0.2-py2.7.egg',   
'/usr/local/lib/python2.7/dist-packages/certifi-14.05.14-py2.7.egg',  
'/usr/local/lib/python2.7/dist-packages/selenium-2.44.0-py2.7.egg',  
'/usr/lib/python2.7/dist-packages',  
'/usr/lib/python2.7/dist-packages/PILcompat',  
'/usr/lib/python2.7/dist-packages/gtk-2.0',  
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

我在 Ubuntu 14.04

0 个答案:

没有答案