色々事情があって、最終更新がJan 2, 2013のMySQL-python 1.2.4をDebianにインストールすることになってどハマりして、Successfully installed MySQL-python-1.2.4 を拝むまでの記録。
vagrantでDebian 8/9/10の環境を用意して試した。
Debian 8
バージョン確認。
vagrant@jessie:~$ cat /etc/debian_version
8.11
まずはpipをインストール。
vagrant@jessie:~$ sudo apt install python-pip
バージョン指定してpipでインストール、普通ならこれで終わりだけど SSL is required
だと?
vagrant@jessie:~$ sudo pip install MySQL-python==1.2.4
Downloading/unpacking MySQL-python==1.2.4
Downloading MySQL-python-1.2.4.zip (113kB): 113kB downloaded
Running setup.py (path:/tmp/pip-build-jIgtUz/MySQL-python/setup.py) egg_info for package MySQL-python
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-build-jIgtUz/MySQL-python/setup.py", line 7, in <module>
use_setuptools()
File "distribute_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "distribute_setup.py", line 124, in _do_download
to_dir, download_delay)
File "distribute_setup.py", line 194, in download_setuptools
src = urlopen(url)
File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 475, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: SSL is required
Complete output from command python setup.py egg_info:
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-build-jIgtUz/MySQL-python/setup.py", line 7, in <module>
use_setuptools()
File "distribute_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "distribute_setup.py", line 124, in _do_download
to_dir, download_delay)
File "distribute_setup.py", line 194, in download_setuptools
src = urlopen(url)
File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 475, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: SSL is required
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-jIgtUz/MySQL-python
Storing debug log for failure in /root/.pip/pip.log
仕方がないので -d オプションで MySQL-python-1.2.4.zip をダウンロードして展開、unzipが入ってない場合は先にインストール。
vagrant@jessie:~$ sudo pip install MySQL-python==1.2.4 -d ~/
vagrant@jessie:~$ sudo apt install unzip
vagrant@jessie:~$ unzip MySQL-python-1.2.4.zip
httpな箇所をhttpsに書き換える、
vagrant@jessie:~$ vi MySQL-python-1.2.4/distribute_setup.py
ここ↓ね。
--- MySQL-python-1.2.4/distribute_setup.py.old 2012-10-08 13:46:54.000000000 +0000
+++ MySQL-python-1.2.4/distribute_setup.py 2021-06-12 13:39:46.140000000 +0000
@@ -47,7 +47,7 @@
return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
DEFAULT_VERSION = "0.6.28"
-DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
+DEFAULT_URL = "https://pypi.python.org/packages/source/d/distribute/"
SETUPTOOLS_FAKED_VERSION = "0.6c11"
SETUPTOOLS_PKG_INFO = """\
書き換えたものを使ってインストール、今度は mysql_config not found
だと?
vagrant@jessie:~$ sudo pip install ./MySQL-python-1.2.4
Unpacking ./MySQL-python-1.2.4
Running setup.py (path:/tmp/pip-ev1n8l-build/setup.py) egg_info for package from file:///home/vagrant/MySQL-python-1.2.4
Downloading https://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /tmp/tmph3cJsv
Now working in /tmp/tmph3cJsv/distribute-0.6.28
Building a Distribute egg in /tmp/pip-ev1n8l-build
/tmp/pip-ev1n8l-build/distribute-0.6.28-py2.7.egg
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-ev1n8l-build/setup.py", line 18, 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 25, 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:
Downloading https://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /tmp/tmph3cJsv
Now working in /tmp/tmph3cJsv/distribute-0.6.28
Building a Distribute egg in /tmp/pip-ev1n8l-build
/tmp/pip-ev1n8l-build/distribute-0.6.28-py2.7.egg
sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip-ev1n8l-build/setup.py", line 18, 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 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-ev1n8l-build
Storing debug log for failure in /root/.pip/pip.log
必要なパッケージを追加。
vagrant@jessie:~$ sudo apt install libmysqlclient-dev
今度こそ、と思ったら Python.h: No such file or directory だと?
vagrant@jessie:~$ sudo apt install libmysqlclient-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libmysqlclient18 mysql-common zlib1g zlib1g-dev
The following NEW packages will be installed:
libmysqlclient-dev libmysqlclient18 mysql-common zlib1g-dev
The following packages will be upgraded:
zlib1g
1 upgraded, 4 newly installed, 0 to remove and 75 not upgraded.
Need to get 1,988 kB of archives.
After this operation, 9,851 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.debian.org/ jessie/updates/main zlib1g amd64 1:1.2.8.dfsg-2+deb8u1 [88.3 kB]
Get:2 http://security.debian.org/ jessie/updates/main mysql-common all 5.5.62-0+deb8u1 [75.7 kB]
Get:3 http://security.debian.org/ jessie/updates/main libmysqlclient18 amd64 5.5.62-0+deb8u1 [671 kB]
Get:4 http://security.debian.org/ jessie/updates/main zlib1g-dev amd64 1:1.2.8.dfsg-2+deb8u1 [206 kB]
Get:5 http://security.debian.org/ jessie/updates/main libmysqlclient-dev amd64 5.5.62-0+deb8u1 [948 kB]
Fetched 1,988 kB in 0s (3,079 kB/s)
Reading changelogs... Done
(Reading database ... 38386 files and directories currently installed.)
Preparing to unpack .../zlib1g_1%3a1.2.8.dfsg-2+deb8u1_amd64.deb ...
Unpacking zlib1g:amd64 (1:1.2.8.dfsg-2+deb8u1) over (1:1.2.8.dfsg-2+b1) ...
Setting up zlib1g:amd64 (1:1.2.8.dfsg-2+deb8u1) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...
Selecting previously unselected package mysql-common.
(Reading database ... 38385 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.5.62-0+deb8u1_all.deb ...
Unpacking mysql-common (5.5.62-0+deb8u1) ...
Selecting previously unselected package libmysqlclient18:amd64.
Preparing to unpack .../libmysqlclient18_5.5.62-0+deb8u1_amd64.deb ...
Unpacking libmysqlclient18:amd64 (5.5.62-0+deb8u1) ...
Selecting previously unselected package zlib1g-dev:amd64.
Preparing to unpack .../zlib1g-dev_1%3a1.2.8.dfsg-2+deb8u1_amd64.deb ...
Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-2+deb8u1) ...
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack .../libmysqlclient-dev_5.5.62-0+deb8u1_amd64.deb ...
Unpacking libmysqlclient-dev (5.5.62-0+deb8u1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up mysql-common (5.5.62-0+deb8u1) ...
Setting up libmysqlclient18:amd64 (5.5.62-0+deb8u1) ...
Setting up zlib1g-dev:amd64 (1:1.2.8.dfsg-2+deb8u1) ...
Setting up libmysqlclient-dev (5.5.62-0+deb8u1) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...
vagrant@jessie:~$ sudo pip install ./MySQL-python-1.2.4
Unpacking ./MySQL-python-1.2.4
Running setup.py (path:/tmp/pip-g1ltYw-build/setup.py) egg_info for package from file:///home/vagrant/MySQL-python-1.2.4
Downloading https://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /tmp/tmp_5J0QV
Now working in /tmp/tmp_5J0QV/distribute-0.6.28
Building a Distribute egg in /tmp/pip-g1ltYw-build
/tmp/pip-g1ltYw-build/distribute-0.6.28-py2.7.egg
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python
building '_mysql' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:29:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-g1ltYw-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-KJy79c-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:29:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-g1ltYw-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-KJy79c-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-g1ltYw-build
Storing debug log for failure in /root/.pip/pip.log
じゃあ追加だ!
vagrant@jessie:~$ sudo apt install python-dev
そして今度こそ!
vagrant@jessie:~$ sudo apt install python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libexpat1 libexpat1-dev libpython-dev libpython2.7 libpython2.7-dev libpython2.7-minimal libpython2.7-stdlib
python2.7 python2.7-dev python2.7-minimal
Suggested packages:
python2.7-doc binfmt-support
The following NEW packages will be installed:
libexpat1-dev libpython-dev libpython2.7 libpython2.7-dev python-dev python2.7-dev
The following packages will be upgraded:
libexpat1 libpython2.7-minimal libpython2.7-stdlib python2.7 python2.7-minimal
5 upgraded, 6 newly installed, 0 to remove and 70 not upgraded.
Need to get 24.1 MB of archives.
After this operation, 35.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://httpredir.debian.org/debian/ jessie/main libpython-dev amd64 2.7.9-1 [19.6 kB]
Get:2 http://httpredir.debian.org/debian/ jessie/main python-dev amd64 2.7.9-1 [1,182 B]
Get:3 http://security.debian.org/ jessie/updates/main libexpat1 amd64 2.1.0-6+deb8u6 [80.3 kB]
Get:4 http://security.debian.org/ jessie/updates/main python2.7 amd64 2.7.9-2+deb8u5 [252 kB]
Get:5 http://security.debian.org/ jessie/updates/main python2.7-minimal amd64 2.7.9-2+deb8u5 [1,404 kB]
Get:6 http://security.debian.org/ jessie/updates/main libpython2.7-stdlib amd64 2.7.9-2+deb8u5 [1,850 kB]
Get:7 http://security.debian.org/ jessie/updates/main libpython2.7-minimal amd64 2.7.9-2+deb8u5 [379 kB]
Get:8 http://security.debian.org/ jessie/updates/main libpython2.7 amd64 2.7.9-2+deb8u5 [1,080 kB]
Get:9 http://security.debian.org/ jessie/updates/main libexpat1-dev amd64 2.1.0-6+deb8u6 [126 kB]
Get:10 http://security.debian.org/ jessie/updates/main libpython2.7-dev amd64 2.7.9-2+deb8u5 [18.6 MB]
Get:11 http://security.debian.org/ jessie/updates/main python2.7-dev amd64 2.7.9-2+deb8u5 [297 kB]
Fetched 24.1 MB in 1s (14.3 MB/s)
Reading changelogs... Done
(Reading database ... 38503 files and directories currently installed.)
Preparing to unpack .../libexpat1_2.1.0-6+deb8u6_amd64.deb ...
Unpacking libexpat1:amd64 (2.1.0-6+deb8u6) over (2.1.0-6+deb8u4) ...
Preparing to unpack .../python2.7_2.7.9-2+deb8u5_amd64.deb ...
Unpacking python2.7 (2.7.9-2+deb8u5) over (2.7.9-2+deb8u2) ...
Preparing to unpack .../python2.7-minimal_2.7.9-2+deb8u5_amd64.deb ...
Unpacking python2.7-minimal (2.7.9-2+deb8u5) over (2.7.9-2+deb8u2) ...
Preparing to unpack .../libpython2.7-stdlib_2.7.9-2+deb8u5_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.9-2+deb8u5) over (2.7.9-2+deb8u2) ...
Preparing to unpack .../libpython2.7-minimal_2.7.9-2+deb8u5_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.9-2+deb8u5) over (2.7.9-2+deb8u2) ...
Selecting previously unselected package libpython2.7:amd64.
Preparing to unpack .../libpython2.7_2.7.9-2+deb8u5_amd64.deb ...
Unpacking libpython2.7:amd64 (2.7.9-2+deb8u5) ...
Selecting previously unselected package libexpat1-dev:amd64.
Preparing to unpack .../libexpat1-dev_2.1.0-6+deb8u6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.1.0-6+deb8u6) ...
Selecting previously unselected package libpython2.7-dev:amd64.
Preparing to unpack .../libpython2.7-dev_2.7.9-2+deb8u5_amd64.deb ...
Unpacking libpython2.7-dev:amd64 (2.7.9-2+deb8u5) ...
Selecting previously unselected package libpython-dev:amd64.
Preparing to unpack .../libpython-dev_2.7.9-1_amd64.deb ...
Unpacking libpython-dev:amd64 (2.7.9-1) ...
Selecting previously unselected package python2.7-dev.
Preparing to unpack .../python2.7-dev_2.7.9-2+deb8u5_amd64.deb ...
Unpacking python2.7-dev (2.7.9-2+deb8u5) ...
Selecting previously unselected package python-dev.
Preparing to unpack .../python-dev_2.7.9-1_amd64.deb ...
Unpacking python-dev (2.7.9-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for mime-support (3.58) ...
Setting up libexpat1:amd64 (2.1.0-6+deb8u6) ...
Setting up libpython2.7-minimal:amd64 (2.7.9-2+deb8u5) ...
Setting up python2.7-minimal (2.7.9-2+deb8u5) ...
Setting up libpython2.7-stdlib:amd64 (2.7.9-2+deb8u5) ...
Setting up python2.7 (2.7.9-2+deb8u5) ...
Setting up libpython2.7:amd64 (2.7.9-2+deb8u5) ...
Setting up libexpat1-dev:amd64 (2.1.0-6+deb8u6) ...
Setting up libpython2.7-dev:amd64 (2.7.9-2+deb8u5) ...
Setting up libpython-dev:amd64 (2.7.9-1) ...
Setting up python2.7-dev (2.7.9-2+deb8u5) ...
Setting up python-dev (2.7.9-1) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...
vagrant@jessie:~$ sudo pip install ./MySQL-python-1.2.4
Unpacking ./MySQL-python-1.2.4
Running setup.py (path:/tmp/pip-UyBGxw-build/setup.py) egg_info for package from file:///home/vagrant/MySQL-python-1.2.4
Downloading https://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /tmp/tmp7Rth9d
Now working in /tmp/tmp7Rth9d/distribute-0.6.28
Building a Distribute egg in /tmp/pip-UyBGxw-build
/tmp/pip-UyBGxw-build/distribute-0.6.28-py2.7.egg
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python
building '_mysql' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
In file included from _mysql.c:44:0:
/usr/include/mysql/my_config.h:423:0: warning: "HAVE_WCSCOLL" redefined
#define HAVE_WCSCOLL
^
In file included from /usr/include/python2.7/pyconfig.h:3:0,
from /usr/include/python2.7/Python.h:8,
from _mysql.c:29:
/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h:911:0: note: this is the location of the previous definition
#define HAVE_WCSCOLL 1
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient_r -lpthread -lz -lm -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
Successfully installed MySQL-python
Cleaning up...
Successfully installed MySQL-python !!
Debian 9
バージョン確認
vagrant@stretch:~$ cat /etc/debian_version
9.12
基本的にはDebian 8と同じ手順
- libmysqlclient-devの代わりに default-libmysqlclient-dev を追加する
- python-devはpython-pipと一緒に入るから個別に入れなくていい
Debian 10
問題はコイツ
バージョン確認
vagrant@buster:~$ cat /etc/debian_version
10.9
pip入れてpip installしようとすると SSL is required
と言われるまではDebian 8と同じ。
-d オプションでダウンロードしょうとすると nosuch option: -d
と言われるので、最初に表示されているURLから直接ダウンロードする。
vagrant@buster:~$ curl -OL https://files.pythonhosted.org/packages/90/5a/ce7bef80825c2188cf507baf57b37516e18dffdb198a6766a597f703059a/MySQL-python-1.2.4.zip
unzipパッケージ追加してhttpをhttpsに書き換えるまではDebian 8と同じ。
展開したファイルでpip installしようとすると mysql_config not found
と言われるから、Debian 9と同じように default-libmysqlclient-dev を追加してしまうと、↓のようなググりようのないエラーが出てしまうので入れちゃダメですよ。
vagrant@buster:~$ sudo pip install ./MySQL-python-1.2.4
Processing ./MySQL-python-1.2.4
Building wheels for collected packages: MySQL-python
Running setup.py bdist_wheel for MySQL-python ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-9n_BMX/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-OQdcSh --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
In file included from _mysql.c:44:
/usr/include/mariadb/my_config.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
#warning This file should not be included by clients, include only <mysql.h>
^~~~~~~
_mysql.c: In function ‘_mysql_ConnectionObject_ping’:
_mysql.c:1983:41: error: ‘MYSQL’ {aka ‘struct st_mysql’} has no member named ‘reconnect’
if ( reconnect != -1 ) self->connection.reconnect = reconnect;
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for MySQL-python
Running setup.py clean for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-9n_BMX/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-rbyv6T/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
In file included from _mysql.c:44:
/usr/include/mariadb/my_config.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
#warning This file should not be included by clients, include only <mysql.h>
^~~~~~~
_mysql.c: In function ‘_mysql_ConnectionObject_ping’:
_mysql.c:1983:41: error: ‘MYSQL’ {aka ‘struct st_mysql’} has no member named ‘reconnect’
if ( reconnect != -1 ) self->connection.reconnect = reconnect;
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-9n_BMX/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-rbyv6T/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-req-build-9n_BMX/
Debian 9 のdefault-libmysqlclient-devは1.0.2で、Debian 10のは1.0.5だから、下げればいいのかと思ったけど、他のバージョンは選べない。
vagrant@buster:~$ apt list --all-versions default-libmysqlclient-dev
Listing... Done
default-libmysqlclient-dev/stable,now 1.0.5 amd64 [installed]
そうか!Oracleに公式なアーカイブがあるじゃないか!
APT用パッケージ追加、まさかのCUIインストーラーが起動するけど、
ここで、MySQL Server & Clusterをmysql-8.0から mysql-5.7に変える 。
vagrant@buster:~$ curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.17-1_all.deb
vagrant@buster:~$ sudo apt install ./mysql-apt-config_0.8.17-1_all.deb
apt updateして、
vagrant@buster:~$ sudo apt update
Oracleのリポジトリからパッケージ追加
vagrant@buster:~$ sudo apt install libmysqlclient-dev
再びインストールすれば、
vagrant@buster:~$ sudo pip install ./MySQL-python-1.2.4
Processing ./MySQL-python-1.2.4
Building wheels for collected packages: MySQL-python
Running setup.py bdist_wheel for MySQL-python ... done
Stored in directory: /root/.cache/pip/wheels/b5/b3/5a/9eca72007cf3556aafec42a198d8c0a20b4fa9545b64619e19
Successfully built MySQL-python
Installing collected packages: MySQL-python
Successfully installed MySQL-python-1.2.4
Successfully installed MySQL-python-1.2.4!!