Tôi thêm python 2.7.13 như một altinstall bằng cách cài đặt mã nguồn để hộp RHEL4 tôi vớiPython Build Lỗi: thất bại trong việc xây dựng các module _ssl và _hashlib
wget --no-check-certificate https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz
tar -xvzf Python2.7.13.tar.xz
cd Python2.7.13
./configure --with-ensurepip=install
make
make test
make altinstall
vì vậy mà tôi không ghi đè lên python mặc định đó là cần thiết cho sử dụng khác. Python 2.7.13 sẽ cài đặt thành công nhưng thiếu một số mô-đun cần thiết cho dự án tôi đang làm việc.
Ban đầu mô-đun _ssl và _haslib sẽ bị lỗi trong phần này.
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _sqlite3 _tkinter
bsddb185 dbm dl
gdbm imageop sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Tôi đã cài đặt openssl và đảm bảo rằng họ đang ở trong vị trí mặc định mà trăn đang tìm kiếm họ, vì vậy bây giờ tôi có các bit cần thiết nhưng sau đó nó kết thúc với thông điệp này để thay thế
Failed to build these modules:
_hashlib _ssl
Dưới đây là toàn bộ đầu ra của python2.7 setup.py build
từ gói python đã giải nén. Tôi đã được cọ rửa google và bất cứ nơi nào tôi có thể tìm thấy nhưng tôi đã không thành công trong bất cứ điều gì cho đến nay
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
building '_ssl' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/ssl/include -I. -IInclude -I./Include -I/usr/local/include -I/usr/local/include/python2.7 -c /Python/Modules/_ssl.c -o build/temp.linux-x86_64-2.7/Python/Modules/_ssl.o
/Python/Modules/_ssl.c:57: warning: ignoring #pragma GCC diagnostic
/Python/Modules/_ssl.c: In function ‘_setup_ssl_threads’:
/Python/Modules/_ssl.c:4012: warning: comparison is always false due to limited range of data type
gcc -pthread -shared build/temp.linux-x86_64-2.7/Python/Modules/_ssl.o -L/usr/local/ssl/lib -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-2.7/_ssl.so
/usr/bin/ld: /usr/local/ssl/lib/libssl.a(s3_meth.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
building '_hashlib' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/ssl/include -I. -IInclude -I./Include -I/usr/local/include -I/usr/local/include/python2.7 -c /Python/Modules/_hashopenssl.c -o build/temp.linux-x86_64-2.7/Python/Modules/_hashopenssl.o
gcc -pthread -shared build/temp.linux-x86_64-2.7/Python/Modules/_hashopenssl.o -L/usr/local/ssl/lib -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-2.7/_hashlib.so
/usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(o_names.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _sqlite3 _tkinter
bsddb185 dbm dl
gdbm imageop sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Failed to build these modules:
_hashlib _ssl
running build_scripts
Khi tôi cố gắng sử dụng pip được cài đặt với python tôi 2.7.13 Tôi nhận được một lỗi SSL vì vậy tôi đã cài đặt tất cả các gói của tôi và các mô-đun khác từ nguồn như cx_Oracle và CherryPy.
pip2.7 install cffi
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting cffi
Could not fetch URL https://pypi.python.org/simple/cffi/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement cffi (from versions:)
No matching distribution found for cffi
Tôi cũng cố gắng thêm các module ssl bằng tay với
wget --no-check-certificate https://pypi.python.org/packages/83/21/f469c9923235f8c36d5fd5334ed11e2681abad7e0032c5aba964dcaf9bbb/ssl-1.16.tar.gz#md5=fb12d335d56f3c8c7c1fefc1c06c4bfb
tar -xvzf ssl-1.16.tar.gz
cd ssl-1.16
python2.7 setup.py build
Nhưng tôi nhận được một lỗi mà nó không nên được sử dụng với python qua 2,6
Traceback (most recent call last):
File "setup.py", line 12, in <module>
+ "or earlier.")
ValueError: This extension should not be used with Python 2.6 or later (already built in), and has not been tested with Python 2.3.4 or earlier.
EDIT
Tôi đang tìm kiếm các giải pháp và sau khi chải o ver đầu ra của setup.py build
và tìm thấy một người nào đó với một vấn đề tương tự-ish mà dường như có liên quan đến openssl here vì vậy tôi xây dựng lại openssl tôi với
./config enable-shared
make
make test
make install
và bây giờ tôi nhận được một lỗi hơi khác nhau về mô-đun ssl, Tôi chỉ đang vặn vẹo môi trường của mình ngày càng nhiều hơn?
python2.7 setup.py build
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
building '_ssl' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/ssl/include -I. -IInclude -I./Include -I/usr/local/include -I/usr/local/include/python2.7 -c /Python/Modules/_ssl.c -o build/temp.linux-x86_64-2.7/Python/Modules/_ssl.o
/Python/Modules/_ssl.c:57: warning: ignoring #pragma GCC diagnostic
/Python/Modules/_ssl.c: In function ‘_setup_ssl_threads’:
/Python/Modules/_ssl.c:4012: warning: comparison is always false due to limited range of data type
gcc -pthread -shared build/temp.linux-x86_64-2.7/Python/Modules/_ssl.o -L/usr/local/ssl/lib -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-2.7/_ssl.so
*** WARNING: renaming "_ssl" since importing it failed: libssl.so.1.0.0: cannot open shared object file: No such file or directory
building '_hashlib' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/ssl/include -I. -IInclude -I./Include -I/usr/local/include -I/usr/local/include/python2.7 -c /Python/Modules/_hashopenssl.c -o build/temp.linux-x86_64-2.7/Python/Modules/_hashopenssl.o
gcc -pthread -shared build/temp.linux-x86_64-2.7/Python/Modules/_hashopenssl.o -L/usr/local/ssl/lib -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-2.7/_hashlib.so
*** WARNING: renaming "_hashlib" since importing it failed: libssl.so.1.0.0: cannot open shared object file: No such file or directory
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _sqlite3 _tkinter
bsddb185 dbm dl
gdbm imageop sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Failed to build these modules:
_hashlib _ssl
running build_scripts
Thông điệp cảnh báo mới trong đầu ra *** WARNING: renaming "_ssl" since importing it failed: libssl.so.1.0.0: cannot open shared object file: No such file or directory
chỉ ra rằng tập tin không tồn tại nhưng tôi thấy nó trong/usr/local/ssl/lib/như libssl.so.1.0.0 và có thể tìm thấy nó với một tìm kiếm
find/-name libssl.so.1.0.0
/usr/local/ssl/lib/libssl.so.1.0.0
/tmp/openssl-1.0.2l/libssl.so.1.0.0
FYI cx_Oracle 6 (hiện đang ở trạng thái phát hành RC 1) có Bánh xe để mọi hướng dẫn cài đặt cũ hơn có khả năng bị lỗi thời. Ngoài ra nếu xây dựng nó từ nguồn, bạn không còn cần tập tin tiêu đề Oracle. –