我有一些简单的python代码,它可以从解释器中正常工作,但是当我尝试导入urllib2
并使用pyinstaller打包它时,我收到以下错误:
root@localhost:/root# ./test
Traceback (most recent call last):
File "<string>", line 8, in <module>
File "/usr/local/lib/python2.7/site-packages/PyInstaller-3.1.1-py2.7.egg/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "requests/__init__.py", line 58, in <module>
File "/usr/local/lib/python2.7/site-packages/PyInstaller-3.1.1-py2.7.egg/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "requests/utils.py", line 12, in <module>
File "/usr/local/lib/python2.7/site-packages/PyInstaller-3.1.1-py2.7.egg/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "cgi.py", line 50, in <module>
File "/usr/local/lib/python2.7/site-packages/PyInstaller-3.1.1-py2.7.egg/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "mimetools.py", line 6, in <module>
File "/usr/local/lib/python2.7/site-packages/PyInstaller-3.1.1-py2.7.egg/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "tempfile.py", line 32, in <module>
File "/usr/local/lib/python2.7/site-packages/PyInstaller-3.1.1-py2.7.egg/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "io.py", line 51, in <module>
File "/usr/local/lib/python2.7/site-packages/PyInstaller-3.1.1-py2.7.egg/PyInstaller/loader/pyimod03_importers.py", line 546, in load_module
module = imp.load_module(fullname, fp, filename, ext_tuple)
ImportError: /tmp/_MEIgQLoAL/_io.so: undefined symbol: _PyLong_AsInt
test returned -1
Python代码示例:
import urllib2
read = urllib2.urlopen("http://google.com").read()
print read
我错过了什么?