当我编译二进制文件(3.3.2版本)并运行./python
时,如果我导入hashlib,我收到此错误:
:akiva@akiva-ThinkPad-X230:~/Programming/Projects/youtube-downloader/static/static-python$ ./python
Python 3.3.2+ (default, Aug 4 2015, 03:07:14)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 141, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/akiva/Programming/Projects/youtube-downloader/static/static-python/Lib/hashlib.py", line 91, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
我用这个命令编译:
make -f Static.make BUILTINS="_bisect _codecs_cn _codecs_hk _codecs_iso2022 _codecs_jp _codecs_kr _codecs_tw _collections _csv _ctypes _ctypes_test _elementtree _functools _hashlib _heapq _hotshot _io _json _locale _lsprof _multibytecodec _multiprocessing _random _socket _struct _testcapi array audioop binascii cmath crypt fcntl future_builtins grp itertools linuxaudiodev math mmap nis operator ossaudiodev parser pyexpat resource select spwd syslog termios time unicodedata zlib ssl atexit"
这么多模块的主要原因是确保它与youtube-dl的脚本兼容。
这个问题似乎有解决方案:
Error importing hashlib with python 2.7 but not with 2.6
但是这个解决方案显然不适用于静态版本的python。这是我正在寻找的解决方案,有没有办法在运行make命令时链接openssl?