I've tried to create an exe file using py2exe. I've recently updated Python from 2.7.7 to 2.7.10 to be able to work with requests
- proxies
.
Before the update everything worked fine but now, the exe file recently created, raising this error:
Traceback (most recent call last):
File "puoka_2.py", line 1, in <module>
import mLib
File "mLib.pyc", line 4, in <module>
File "urllib2.pyc", line 94, in <module
File "httplib.pyc", line 71, in <module
File "socket.pyc", line 68, in <module>
ImportError: cannot import name RAND_egd
It could be probably repaired by changing options
in setup.py file but I can't figure out what I have to write there. I've tried options = {'py2exe': {'packages': ['requests','urllib2']}})
but with no success.
It works as a Python script but not as an exe.
Do anybody knows what to do?
EDIT:
I've tried to put into setup.py
file this import: from _ssl import RAND_egd
and it says that it can't be imported.
EDIT2: Setup.py:
from distutils.core import setup
import py2exe
# from _ssl import RAND_egd
setup(
console=['puoka_2.py'],
options = {'py2exe': {'packages': ['requests']}})
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…