title: pyinstaller: AttributeError: 'module' object has no attribute 'RSA'
body: <p><strong>My python file runs all right with python directly:</strong></p>
  
  <pre><code>python detectIPConflict.py
  </code></pre>
  
  <p><strong>However, when the script packaged by PyInstaller:</strong></p>
  
  <pre><code>pyinstaller --onefile detectIPConflict.py
  ./dist/detectIPConflict
  </code></pre>
  
  <p><strong>Here goes the error:</strong></p>
  
  <pre><code>WARNING: No route found for IPv6 destination :: (no default route?)
  Traceback (most recent call last):
    File "&lt;string&gt;", line 3, in &lt;module&gt;
    File "/usr/local/lib/python2.7/dist-packages/PyInstaller-3.1.1-py2.7.egg/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
      exec(bytecode, module.__dict__)
    File "scapy/all.py", line 46, in &lt;module&gt;
    File "/usr/local/lib/python2.7/dist-packages/PyInstaller-3.1.1-py2.7.egg/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
      exec(bytecode, module.__dict__)
    File "scapy/crypto/__init__.py", line 17, in &lt;module&gt;
    File "/usr/local/lib/python2.7/dist-packages/PyInstaller-3.1.1-py2.7.egg/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
      exec(bytecode, module.__dict__)
    File "scapy/crypto/cert.py", line 19, in &lt;module&gt;
  AttributeError: 'module' object has no attribute 'RSA'
  detectIPConflict returned -1
  </code></pre>
  
  <p><strong>I also have seek into the scapy/crypto/cert.py, in line 19:</strong></p>
  
  <pre><code>from Crypto.PublicKey import *
  </code></pre>
  
  <p><strong>I can not find why this error happened.
  I'm get confused.</strong> </p>
  
  <p><strong>Anyone can help?</strong></p>
  
  <p>Version info:</p>
  
  <ul>
  <li>Python: 2.7.6</li>
  <li>pyinstaller: 3.1.1</li>
  <li>scapy: 2.3.2 (installed by pip command)</li>
  <li>pycrypto: 2.6.1</li>
  </ul>
  
  <p>Here is the detectIPConflict.py:</p>
  
  <pre><code>#!/usr/bin/env python
  # -*- coding:utf-8 -*-
  from scapy.all import *
  
  def ip_conflict():
      ipscan='10.2.86.190/23'
      ip_dict = dict()
      ip_me = get_if_addr('eth0')
      mac_me = get_if_hwaddr('eth0')
      print "--------IP ME---------"
      print ip_me, "--", mac_me
      print "----------------------"
      ip_dict[ip_me] = mac_me
      try:
          ans,unans=srp(Ether(dst="FF:FF:FF:FF:FF:FF")/ARP(pdst=ipscan),iface="br0", timeout=2,verbose=False)
      except Exception,e:
          print str(e)
      else:
          print ("   MAC            --   IP   ")
          for snd,rcv in ans:
              list_mac=rcv.sprintf("%Ether.src% -- %ARP.psrc%")
              mac = rcv.sprintf("%Ether.src%")
              ip = rcv.sprintf("%ARP.psrc%")
              # print mac,'--&gt;',ip
              if ip not in ip_dict:
                  ip_dict[ip] = mac
      for has_ip in ip_dict.keys():
          print has_ip, "------ " + ip_dict[has_ip]
  if __name__ == "__main__":
      ip_conflict()
  </code></pre>