This question already has answers here:
installing MySQLdb for Python 2.6 on OSX [duplicate]
(4 answers)
Closed 9 years ago.
*My larger problem is that I cannot launch a web application using dev_apperver.py from my command line*
However, I also cannot install MySQLdb as well.
Joes-MacBook-Pro:MySQL-python-1.2.3 MoeJancini$ python setup.py build
sh: mysql_config: command not found
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "/Users/MoeJancini/Desktop/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/Users/MoeJancini/Desktop/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Joes-MacBook-Pro:MySQL-python-1.2.3 MoeJancini$
I have looked at similar questions an navigated other forums but I still cannot get past the setup.py build command. Explicit instructions on how to get MySQLdb working would be useful since I'm a noob. Thank you
It depends on what your source for MySQL is. If you're using MacPorts, you may find that you have to use mysql_config5in order for it to work. Edit site.cfg so that it has the right path. Then again, if you're using MacPorts, you should just sudo port install py-mysql and that will install it for you.
So if you're not using MacPorts, you're probably using the mysql.com packages. In that case, you need to install their Connector/C package, which includes development headers and libraries and mysql_config.
Related
This question already has answers here:
Unable to install pygame on Python via pip (Windows 10)
(6 answers)
Closed 2 years ago.
So I've got a bit of an issue with python and/or pip...
Python, when asked to download pygame in CMD with py -m pip install -U pygame --user, gives me this error:
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x64"? [Y/n]Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\gary\AppData\Local\Temp\pip-install-1zalja6w\pygame\setup.py", line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\gary\AppData\Local\Temp\pip-install-1zalja6w\pygame\buildconfig\config.py", line 210, in main
deps = CFG.main(**kwds)
File "C:\Users\gary\AppData\Local\Temp\pip-install-1zalja6w\pygame\buildconfig\config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\gary\AppData\Local\Temp\pip-install-1zalja6w\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
It seems to download the files just fine but does NOT like to continue after that. I'm running python 3.8. And yes, Python is installed in the PATH variable.
I feel like this could be a really stupid issue and I've just overlooked something but I cant seem to find anything that helps.
-----edit-----
I've worked out a bit of a solution - just download and use python 3.7 instead of 3.8 and that seems to work better.
Assuming you're using an IDE with the ability to automatically install imports (PyCharm for example) you can just set your IDE's current interpreter to python 3.7.4 and use it to install pygame instead of using pip. The problem has something to do with the pygame install not working with python 3.8 so either revert your interpreter, role back to python 3.7 or wait for pygame to get updated
I am testing scrapy for the first time, and after installing it with the command:
sudo easy_install -U scrapy
everything seems to run ok. However, when I run:
scrapy startproject tutorial
I get the following:
luismacbookpro:~ luis$ scrapy startproject tutorial
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/Current/bin/scrapy", line 4, in <module>
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/pkg_resources.py", line 2711, in <module>
working_set.require(__requires__)
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/pkg_resources.py", line 690, in require
needed = self.resolve(parse_requirements(requirements))
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/pkg_resources.py", line 588, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: lxml
Any idea about what's going on? As you can tell, I am not proficient at all with OSX, and I am still trying to move from a windows "mentality" to OSX, so I don't know where to add paths, modify settings, dependencies, etc. Not even sure how to perform a clean uninstall and start all over.
Any feedback is appreciated, even your suggestions to use alternative python libraries that can perform the same functionality of scrapy. Thanks!
I think this will solve the error message you're seeing:
sudo easy_install --upgrade lxml
This problem can arise on Macs when you use pip to install some packages and easy_install to install others.
Let us know how you go :)
I'm trying to use MySQL with django and right now the following isn't executing properly:
python manage.py syncdb
I also downloaded the Mysql-python interpreter and ran the following lines but still an error:
python setup.py build
sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "/Users/user/Downloads/MySQL-python-1.2.3/setup_posix.py", line 49, in get_config
libs = mysql_config("libs")
File "/Users/user/Downloads/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: /usr/local/bin/mysql_config not found
I think it's having trouble finding mysql_config, is there a way that I can point the setup to the file? Right now my setup.py is in ~/Downloads and mysql is in /usr/local/mysql/bin
It seems you may not have any of the MySQL client applications installed. If you are using Linux (and this varies from distribution to distribution), the package you will need to install on Ubuntu is "mysql-client".
From the path you show, I'm guessing you are running on Mac OS X (you really need to state what platform you are using and what version of Python you are running). However, if you are on Mac OS X, your best bet by far is to use a complete solution of installing compatible versions of Python, MySQL client libraries, MySQLdb, and Django by using one of the third-party open source package managers on OS X: MacPorts, homebrew, Fink, or others.
See, for example, the answer here.
The answer was to edit the site.cfg file so that it points to the mysql_config file in the /usr/local/mysql dir
When installing mysqldb on mac osx 10.5:
sudo ../bin/python /Users/Awais/mysqlpython/setup.py install
I get the following error:
Traceback (most recent call last):
File "/Users/Awais/mysqlpython/setup.py", line 15, in <module>
metadata, options = get_config()
File "/Users/Awais/mysqlpython/setup_posix.py", line 32, in get_config
metadata, options = get_metadata_and_options()
File "/Users/Awais/mysqlpython/setup_common.py", line 7, in get_metadata_and_options metadata = dict(config.items('metadata'))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ConfigParser.py", line 564, in items
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'metadata'
It seems that you are installing MySQL for Python but you have to have MySQL installed first. So, first download the MySQL installer from http://dev.mysql.com/downloads/mysql/ and install it and then try installing MySQL for Python.
I am trying port an older Linux server RH EL 5 Workstation to CentOS 6.4 64-bit. One of the two things I have had to do -- because it had been a while since I had built a Python-based MySQL server -- was make sure mysql-devel was installed, and from the menu-software install, as well as MySQL-python was installed.
The advantage to installing MySQL-python this way that the CentOS 6.4 distribution matches MySQL-python-1.2.3-0.3.c1.1.el6.x86_64 matches the version of MySQL installed 5.1.69.
Prior to this, I tried building and installing MySQL-python with no success. In a perfect world, I would figure out why, but, like many things, I am on a deadline, and this worked, and was also recommended in posts I read both on SO and elsewhere.
This question already has answers here:
How to install MySQLdb (Python data access library to MySQL) on Mac OS X?
(14 answers)
Closed 9 years ago.
I am trying to install MySQLdb for Python 2.6 as per these instructions:
http://www.tutorialspoint.com/python/python_database_access.htm
When I get to this step: $ python setup.py build I get the error:
users-MacBook-Pro:MySQL-python-1.2.3 user$ sudo python setup.py build
sh: mysql_config: command not found
Traceback (most recent call last):
File "setup.py", line 15, in
metadata, options = get_config()
File "/my_crawler/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/my_crawler/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
I have MySQL installed and added to my bash
What am I doing wrong?
export PATH=$PATH:/usr/local/mysql/bin/
should fix the issue for you as the system is not able to find the mysql_config file.
While PlanetUnknown is on the right track with his/her answer, I hope this more explicit set of steps will prove useful:
The problem has to do with MySQLdb not knowing where to look for the mysql_config file.
So, let's find it for MySQLdb and then put the location in its site.cfg file so that it can find it from now on.
The OP is on a Mac, so open up the terminal and find the site.cfg file:
sudo find / -name 'site.cfg'
Wait a few seconds and it should spit out the absolute path, we will vi that file in a second. But first, find the the mysql_config file:
sudo find / -name 'mysql_config'
Before editing the site.cfg file, make sure you have the location of mysql_config on your clipboard.
Once you have site.cfg open in an editor, find the line specifying the path for mysql_config. It is either pointing to the wrong path or just commented out all together. Either way, paste the correct path from your clipboard in place of the existing path.
You should now have a line in that file that reads something like:
mysql_config = /usr/local/path/to/mysql_config
Save the file.
It should be ready to run now, so give it another try.
It's not looking for 'mysql', it's looking for 'mysql_config'. Try running 'which mysql_config' from bash. It probably won't be found. That's why the build isn't finding it either. Try running 'locate mysql_config' and see if anything comes back. The path to this binary needs to be either in your shell's $PATH environment variable, or it needs to be explicitly in the setup.py file for the module assuming it's looking in some specific place for that file.
If you installed mysql from source in /usr/local, I believe the file will be found at /usr/local/mysql/bin/mysql_config
check the site.cfg in your mysqldb folder. It should be at the root.
Edit the site.cfg to the correct path of "mysql_config"
I found mine in "/usr/local/mysql/bin/"
Once done you should be able to run the build & install without any issues.
Remember you should be root or run all commands as "sudo"