Меню

Pip install mysql python ошибки

(mysite)[email protected]:~/zjm_test/mysite$ pip install mysql-python
Downloading/unpacking mysql-python
  Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded
  Running setup.py egg_info for package mysql-python
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 24, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    Complete output from command python setup.py egg_info:
    sh: mysql_config: not found

Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/zjm1126/.pip/pip.log
(mysite)[email protected]:~/zjm_test/mysite$ pip install mysql-python
Downloading/unpacking mysql-python
  Running setup.py egg_info for package mysql-python
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 24, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    Complete output from command python setup.py egg_info:
    sh: mysql_config: not found

Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/zjm1126/.pip/pip.log
click below button to copy the code. By — sql tutorial — team
sudo apt-get install libmysqlclient-dev
click below button to copy the code. By — sql tutorial — team
export PATH=$PATH:/usr/local/mysql/bin
click below button to copy the code. By — sql tutorial — team

Это ошибка, которую я получаю

(mysite)[email protected]:~/zjm_test/mysite$ pip install mysql-python
Downloading/unpacking mysql-python
  Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded
  Running setup.py egg_info for package mysql-python
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 24, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    Complete output from command python setup.py egg_info:
    sh: mysql_config: not found

Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/zjm1126/.pip/pip.log
(mysite)[email protected]:~/zjm_test/mysite$ pip install mysql-python
Downloading/unpacking mysql-python
  Running setup.py egg_info for package mysql-python
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 24, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    Complete output from command python setup.py egg_info:
    sh: mysql_config: not found

Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/zjm1126/.pip/pip.log

Что я могу сделать, чтобы решить эту проблему?

Trusted answers to developer questions

Trusted Answers to Developer Questions

Related Tags

python

django

communitycreator

NDUKWE CHIDERA K.

Take a Free Course

Great engineers are always investing in themselves. Upskill yourself today.

To successfully use Python to communicate to any database, you need to have the Python database client for that database.

When you develop Django web applications and start a project successfully, the project is shipped with the sqlite database and its settings for your use. If you want to use a different database, such as MySql, you have to make changes in the settings file and make sure you install the database client for that database.

Note: You can follow this link to learn how to successfully start a Django project.

What is mysqlclient?

This is a database client application that serves as the medium/interface between the userthe client running Python codes and the mysql database. mysqlclient was developed to replace MySql-python and provides support for Python3, although it is backward compatible as well.

How to use mySqlclient

To use this service, you have to install it through the Python package installer pip, as shown below:

pip install mysqlclient

This command will automatically download and install the mysqlclient package into your device. However, this process is not always problem-free due to some reasons, like pip trying to install the latest version that might not match properly with your system.
If a problem arises, pip will throw an error with a message like mysqliclient installation error.

How to fix this problem

  • First, check that you are connected to the internet and it is stable. Try to run the command again.
  • Next, you will have to manually download and install the package if the problem persists. To do this, you can Google the binary file of mysqlclient that is compatible with your device, or you can go to this site. Please note that this website is not officially owned by the owners of mysql and is more like a support/community forum.
  • Now, after a successful download, you can move the package to the parent directory where your Django project is located, or you can place it anywhere you wish. Go to your command prompt or terminal and use the command below:
cd/to/my/directory/path/to_mysqlclient.exe/file pip install mysqlclient

If I place the package in my Django app parent directory, my command will look something like this:

C:Usersmydevicecodesdjangoapps pip install mysqlclient‑1.4.6‑cp39‑cp39‑win32.whl

You don’t need to type the whole name when you enter the directory that contains the file. Just enter the first few letters of the file’s name and hit the tab key to complete the name.

After that, hit enter to install the package. mysqlclient should install successfully now.

RELATED TAGS

python

django

communitycreator

CONTRIBUTOR

NDUKWE CHIDERA K.

Take a Free Course

Great engineers are always investing in themselves. Upskill yourself today.

Learn in-demand tech skills in half the time

Copyright ©2023 Educative, Inc. All rights reserved.

soc2

  • #1

I’m trying to set up a Python application using the cPanel interface. I’ve successfully created it and added the requirements.txt file.

But when I click the «Run Pip Install» button, and select «requirements.txt», after it spins for a while I get this error message:

error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mysqlclient
error: subprocess-exited-with-error

× Running setup.py install for mysqlclient did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mysqlclientnote: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

The requirements.txt file lists

and my Python app is set to use python 3.8.6.

How can I complete the installation?

cPRex


  • #2

Hey there! cPanel doesn’t officially provide support for Python tools as outlined in our notice at the tope of this documentation page:

but have you tried making sure the mysql-community-devel or mysql-devel package is installed? If that is missing, Pip may not be able to build the mysqlclient properly.

This seems to be a relatively recent error as most information I found about this issue was created within the last 6 months. Here is one example:

  • #3

Thanks. In the end I changed from using mysqlclient to mysql-connector-python which installed OK.

A shame the former didn’t work. If I wanted to try again, how would I install the mysql-community-devel or mysql-devel packages on cPanel?

  • #4

Thanks. In the end I changed from using mysqlclient to mysql-connector-python which installed OK.

A shame the former didn’t work. If I wanted to try again, how would I install the mysql-community-devel or mysql-devel packages on cPanel?

Depends on OS but yum should work for AlmaLinux as well or you can use
dnf install [pkg-name]
yum install [pkg-name]

yum install mysql-devel
yum install mysql-community-devel

or

dnf install mysql-devel
dnf install mysql-community-devel

[[email protected] ~]# yum install mysql-community-devel
Last metadata expiration check: 1:53:02 ago on Wed 11 May 2022 11:43:10 PM CDT.
Package mysql-community-devel-8.0.29-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[[email protected] ~]# ]yum install mysql-devel
bash: ]yum: command not found
[[email protected] ~]# yum install mysql-devel
Last metadata expiration check: 1:54:11 ago on Wed 11 May 2022 11:43:10 PM CDT.
Package mysql-community-devel-8.0.29-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[[email protected] ~]

  • #5

Thank you! I’m a bit wary of installing extra stuff like this, given I’m setting this site up on someone else’s server for them. But it’s useful to know what to do if mysql-connector-python doesn’t work out (or for anyone else finding this page and wondering what to do!).

cPRex


  • #6

I’m glad to hear that worked well!

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Pip install exif ошибка
  • Pip install esptool выдает ошибку