这是我第一次关于stackoverflow的问题。
几天前,我一直在尝试在cpanel服务器上设置python应用。那是我一直在做的一个django项目。所以我想使用pip工具安装mysqlclient。
cPanel,cloudlinux操作系统,apache最新版本,已安装python和ruby选择器
我已经从python3.7切换到3.6从而绕过了这个问题!但我仍然想知道为什么我使用python3.7遇到这些错误?
pip安装mysqlclient:
version node not found for symbol SSLeay@OPENSSL_1.0.1
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
pip install mysqlclient输出:
Collecting mysqlclient
Using cached
https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Complete output from command /home/airtab/virtualenv/public__html_test/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-4c1a9d8u/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-fm79t5sn --python-tag cp37:
ERROR: /opt/alt/python37/lib64/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.7/MySQLdb
creating build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MySQLdb
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/include/mysql -I/usr/include/mysql/.. -I/opt/alt/python37/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
gcc -pthread -shared -Wl,-z,relro -Wl,-rpath=/opt/alt/python37/lib64 -L/opt/alt/openssl/lib64 -Wl,-rpath=/opt/alt/openssl/lib64 build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o -L/usr/lib64/mysql -L/opt/alt/python37/lib64 -lmariadb -lpthread -lz -ldl -lm -lssl -lcrypto -lpython3.7m -o build/lib.linux-x86_64-3.7/MySQLdb/_mysql.cpython-37m-x86_64-linux-gnu.so
/usr/bin/ld: build/lib.linux-x86_64-3.7/MySQLdb/_mysql.cpython-37m-x86_64-linux-gnu.so: version node not found for symbol SSLeay@OPENSSL_1.0.1
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Complete output from command /home/airtab/virtualenv/public__html_test/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-4c1a9d8u/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xtuvq5ww/install-record.txt --single-version-externally-managed --compile --install-headers /home/airtab/virtualenv/public__html_test/3.7/include/site/python3.7/mysqlclient:
ERROR: /opt/alt/python37/lib64/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.7/MySQLdb
creating build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MySQLdb
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/include/mysql -I/usr/include/mysql/.. -I/opt/alt/python37/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
gcc -pthread -shared -Wl,-z,relro -Wl,-rpath=/opt/alt/python37/lib64 -L/opt/alt/openssl/lib64 -Wl,-rpath=/opt/alt/openssl/lib64 build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o -L/usr/lib64/mysql -L/opt/alt/python37/lib64 -lmariadb -lpthread -lz -ldl -lm -lssl -lcrypto -lpython3.7m -o build/lib.linux-x86_64-3.7/MySQLdb/_mysql.cpython-37m-x86_64-linux-gnu.so
/usr/bin/ld: build/lib.linux-x86_64-3.7/MySQLdb/_mysql.cpython-37m-x86_64-linux-gnu.so: version node not found for symbol SSLeay@OPENSSL_1.0.1
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/home/airtab/virtualenv/public__html_test/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-4c1a9d8u/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xtuvq5ww/install-record.txt --single-version-externally-managed --compile --install-headers /home/airtab/virtualenv/public__html_test/3.7/include/site/python3.7/mysqlclient" failed with error code 1 in /tmp/pip-install-4c1a9d8u/mysqlclient/
如果使用cpanel,则>
请检查并允许gcc /编译器
允许特殊用户并启用编译器
如果启用了编译器,请重新启动virtualenv,然后使用命令重试安装
pip install mysqlclient
如果在点子上有问题,请使用命令升级点子:pip install --upgrade pip