安装MySQLClient包时出现错误 cPanel 终端

huangapple go评论69阅读模式
英文:

Error while install MySQLClient package cPanel terminal

问题

在cPanel终端安装MySQLClient包时遇到错误。我是Windows用户,在Windows上完全运行正常,但上传到cPanel并安装mysqlclient时出现问题。

以下是我在cPanel终端收到的错误信息:

((project:3.8)) [shriyamc@callisto project]$ pip install mysqlclient
> Collecting mysqlclient   Using cached mysqlclient-2.1.1.tar.gz (88 kB)
> Preparing metadata (setup.py) ... done Building wheels for collected
> packages: mysqlclient   Building wheel for mysqlclient (setup.py) ...
> error   error: subprocess-exited-with-error
> 
>   × python setup.py bdist_wheel did not run successfully.   │ exit
> code: 1   ╰─> [40 lines of output]
>       mysql_config --version
>       ['10.5.20']
>       mysql_config --libs
>       ['-L/usr/lib64', '-lmariadb', '-pthread', '-ldl', '-lm', '-lpthread', '-lssl', '-lcrypto', '-lz']
>       mysql_config --cflags
>       ['-I/usr/include/mysql', '-I/usr/include/mysql/..']
>       ext_options:
>         library_dirs: ['/usr/lib64']
>         libraries: ['mariadb', 'dl', 'm', 'pthread']
>         extra_compile_args: ['-std=c99']
>         extra_link_args: ['-pthread']
>         include_dirs: ['/usr/include/mysql', '/usr/include/mysql/..']
>         extra_objects: []
>         define_macros: [('version_info', '(2,1,1, 'final',0)'), ('__version__', '2.1.1')]
>       running bdist_wheel
>       running build
>       running build_py
>       creating build
>       creating build/lib.linux-x86_64-cpython-38
>       creating build/lib.linux-x86_64-cpython-38/MySQLdb
>       copying MySQLdb/__init__.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
>       copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
>       copying MySQLdb/connections.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
>       copying MySQLdb/converters.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
>       copying MySQLdb/cursors.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
>       copying MySQLdb/release.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
>       copying MySQLdb/times.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
>       creating build/lib.linux-x86_64-cpython-38/MySQLdb/constants
>       copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
>       copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
>       copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
>       copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
>       copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
>       copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
>       running build_ext
>       building 'MySQLdb._mysql' extension
>       creating build/temp.linux-x86_64-cpython-38
>       creating build/temp.linux-x86_64-cpython-38/MySQLdb
>       gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -O2 -pthread -Wno-unused-result -Wsign-compare -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -O2 -pthread -Wno-unused-result -Wsign-compare -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -O2 -pthread -Wno-unused-result -Wsign-compare -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fPIC -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 -I/usr/include/mysql -I/usr/include/mysql/.. -I/home/shriyamc/virtualenv/project/3.8/include -I/opt/alt/python38/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-cpython-38/MySQLdb/_mysql.o -std=c99
>       error: command '/bin/gcc' failed: Permission denied
>       [end of output]
> 
>   note: This error originates from a subprocess, and is likely not a
> problem with pip.   ERROR: Failed building wheel for MySQL client  
> Running setup.py clean for mysqlclient Failed to build mysqlclient
> ERROR: Could not build wheels for mysqlclient, which is required to
> install pyproject.toml-based projects

希望这对你有帮助。

英文:

Error while install MySQLClient package cPanel terminal.
I am windows user and it's run on windows completely but when upload to cPanel and install mysqlclient it not working

Error which i get in cpanel terminal

((project:3.8)) [shriyamc@callisto project]$ pip install mysqlclient
       > Collecting mysqlclient   Using cached mysqlclient-2.1.1.tar.gz (88 kB)
       > Preparing metadata (setup.py) ... done Building wheels for collected
       > packages: mysqlclient   Building wheel for mysqlclient (setup.py) ...
       > error   error: subprocess-exited-with-error
       > 
       >   × python setup.py bdist_wheel did not run successfully.   │ exit
       > code: 1   ╰─> [40 lines of output]
       >       mysql_config --version
       >       ['10.5.20']
       >       mysql_config --libs
       >       ['-L/usr/lib64', '-lmariadb', '-pthread', '-ldl', '-lm', '-lpthread', '-lssl', '-lcrypto', '-lz']
       >       mysql_config --cflags
       >       ['-I/usr/include/mysql', '-I/usr/include/mysql/..']
       >       ext_options:
       >         library_dirs: ['/usr/lib64']
       >         libraries: ['mariadb', 'dl', 'm', 'pthread']
       >         extra_compile_args: ['-std=c99']
       >         extra_link_args: ['-pthread']
       >         include_dirs: ['/usr/include/mysql', '/usr/include/mysql/..']
       >         extra_objects: []
       >         define_macros: [('version_info', "(2,1,1,'final',0)"), ('__version__', '2.1.1')]
       >       running bdist_wheel
       >       running build
       >       running build_py
       >       creating build
       >       creating build/lib.linux-x86_64-cpython-38
       >       creating build/lib.linux-x86_64-cpython-38/MySQLdb
       >       copying MySQLdb/__init__.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
       >       copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
       >       copying MySQLdb/connections.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
       >       copying MySQLdb/converters.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
       >       copying MySQLdb/cursors.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
       >       copying MySQLdb/release.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
       >       copying MySQLdb/times.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
       >       creating build/lib.linux-x86_64-cpython-38/MySQLdb/constants
       >       copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
       >       copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
       >       copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
       >       copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
       >       copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
       >       copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
       >       running build_ext
       >       building 'MySQLdb._mysql' extension
       >       creating build/temp.linux-x86_64-cpython-38
       >       creating build/temp.linux-x86_64-cpython-38/MySQLdb
       >       gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -O2 -pthread -Wno-unused-result -Wsign-compare -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -O2 -pthread -Wno-unused-result -Wsign-compare -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -O2 -pthread -Wno-unused-result -Wsign-compare -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fPIC -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 -I/usr/include/mysql -I/usr/include/mysql/.. -I/home/shriyamc/virtualenv/project/3.8/include -I/opt/alt/python38/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-cpython-38/MySQLdb/_mysql.o -std=c99
       >       error: command '/bin/gcc' failed: Permission denied
       >       [end of output]
       > 
       >   note: This error originates from a subprocess, and is likely not a
       > problem with pip.   ERROR: Failed building wheel for MySQL client  
       > Running setup.py clean for mysqlclient Failed to build mysqlclient
       > ERROR: Could not build wheels for mysqlclient, which is required to
       > install pyproject.toml-based projects
       >

答案1

得分: 0

以下是翻译好的部分:

如在 cpanel 中描述的,cPanel, L.L.C. 不开发或提供 Python WSGI web 应用程序...。在使用 pip install mysqlclient 时,pip 尝试将 mysqlclient 包构建成一个 wheel,但它不是一个 wheel。

您可以从 apt-get(Debian/Ubuntu)或 yum(Red Hat/CentOS)安装所需的依赖项:

对于 Debian/Ubuntu

sudo apt-get install python3-dev default-libmysqlclient-dev build-essential

对于 Red Hat/CentOS

sudo yum install python3-devel mysql-devel

然后运行 pip install mysqlclient

如果这不起作用,可以尝试使用 mysql-connector-python

pip install mysql-connector-python
英文:

As described in cpanel cPanel, L.L.C. doesn’t develop or ship Python WSGI web applications,... . when using pip install mysqlclient pip try to build mysqlclient package into a wheel but it is not a wheel .

one way you can install the required dependencies from apt-get (Debian/ Ubuntu) or yum (Red Hat/ CentOS) :

> # For Debian/ Ubuntu
> sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
>
> # For Red Hat/ CentOS
> sudo yum install python3-devel mysql-devel

then run pip install mysqlclient

if it didn't work go with mysql-connector-python :

pip install mysql-connector-python

huangapple
  • 本文由 发表于 2023年6月8日 17:42:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76430550.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定