开发者

Python modules import error

开发者 https://www.devze.com 2022-12-31 03:21 出处:网络
Very strange for me: # uname -a Linux localhost.localdomain 2.6.18-194.3.1.el5 #1 SMP Thu May 13 13:09:10 EDT 2010 i686 i686 i386 GNU/Linux

Very strange for me:

# uname -a
Linux localhost.localdomain 2.6.18-194.3.1.el5 #1 SMP Thu May 13 13:09:10 EDT 2010 i686 i686 i386 GNU/Linux
# pwd
/root
# python
Python 2.6.5 (r265:79063, Apr 11 2010, 22:34:44)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "c开发者_StackOverflowredits" or "license" for more information.
>>> import dns
>>>
[3]+  Stopped                 python
# cd /home/user/dev/dns
[root@localhost dns]# python
Python 2.6.5 (r265:79063, Apr 11 2010, 22:34:44)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dns
Traceback (most recent call last):
  File "", line 1, in 
  File "dns.py", line 1, in 
    import dns.resolver
ImportError: No module named resolver
>>>
[4]+  Stopped                 python
#

Summary: I can't import same python module from different path. Any ideas? 0_o

P.S. SELINUX=disabled


What's dns.__file__ in the first case? I suspect it's not coming from the directory you cded into the second time (the current directory when you start Python goes at the front of sys.path) but rather from a package containing that crucial resolver module which the second one appears to be lacking.

0

精彩评论

暂无评论...
验证码 换一张
取 消