Lors de l'utilisation de pyenv sur Mac OS X Yosemite (10.10 ou version ultérieure), je suis tombé sur une bibliothèque que je ne peux pas installer.
Des problèmes et des solutions peuvent déjà être trouvés sur https://github.com/yyuu/pyenv/issues/273.
C'est de l'anglais, donc quand j'étais impatient, je ne pouvais pas du tout entrer dans mon esprit, et parfois je devenais accro à la boue, alors je l'écrirai ici en japonais.
Lorsque j'essaye d'inclure MySQL-python, j'obtiens l'erreur suivante:
$ pip install MySQL-python==1.2.5
Collecting MySQL-python==1.2.5
/Users/nii/.pyenv/versions/project_name/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-python
Running setup.py bdist_wheel for MySQL-python
Complete output from command /Users/nii/.pyenv/versions/project_name/bin/python -c "import setuptools;__file__='/private/var/folders/kp/c6tk2jws71xcncdjhsj7ww8r_shv_8/T/pip-build-w4jYAD/MySQL-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/kp/c6tk2jws71xcncdjhsj7ww8r_shv_8/T/tmpMQMhmppip-wheel-:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.10-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.10-x86_64-2.7
creating build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.10-x86_64-2.7
clang -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.6.23/include/mysql -I/Users/nii/.pyenv/versions/2.7.6/include/python2.7 -c _mysql.c -o build/temp.macosx-10.10-x86_64-2.7/_mysql.o -g -fno-omit-frame-pointer -fno-strict-aliasing
In file included from _mysql.c:44:
/usr/local/Cellar/mysql/5.6.23/include/mysql/my_config.h:348:11: warning: 'SIZEOF_SIZE_T' macro redefined [-Wmacro-redefined]
#define SIZEOF_SIZE_T SIZEOF_LONG
^
/Users/nii/.pyenv/versions/2.7.6/include/python2.7/pymacconfig.h:43:17: note: previous definition is here
# define SIZEOF_SIZE_T 8
^
In file included from _mysql.c:44:
/usr/local/Cellar/mysql/5.6.23/include/mysql/my_config.h:442:9: warning: 'HAVE_WCSCOLL' macro redefined [-Wmacro-redefined]
#define HAVE_WCSCOLL
^
/Users/nii/.pyenv/versions/2.7.6/include/python2.7/pyconfig.h:908:9: note: previous definition is here
#define HAVE_WCSCOLL 1
^
_mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (how < 0 || how >= sizeof(row_converters)) {
~~~ ^ ~
3 warnings generated.
clang -bundle -bundle_loader python.exe -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/nii/.pyenv/versions/2.7.6/lib build/temp.macosx-10.10-x86_64-2.7/_mysql.o -L/usr/local/Cellar/mysql/5.6.23/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.10-x86_64-2.7/_mysql.so
ld: file not found: python.exe
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
Failed building wheel for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python
Complete output from command /Users/nii/.pyenv/versions/project_name/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/kp/c6tk2jws71xcncdjhsj7ww8r_shv_8/T/pip-build-w4jYAD/MySQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/kp/c6tk2jws71xcncdjhsj7ww8r_shv_8/T/pip-TU73Hn-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/nii/.pyenv/versions/project_name/include/site/python2.7/MySQL-python:
running install
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
running build_ext
building '_mysql' extension
clang -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.6.23/include/mysql -I/Users/nii/.pyenv/versions/2.7.6/include/python2.7 -c _mysql.c -o build/temp.macosx-10.10-x86_64-2.7/_mysql.o -g -fno-omit-frame-pointer -fno-strict-aliasing
In file included from _mysql.c:44:
/usr/local/Cellar/mysql/5.6.23/include/mysql/my_config.h:348:11: warning: 'SIZEOF_SIZE_T' macro redefined [-Wmacro-redefined]
#define SIZEOF_SIZE_T SIZEOF_LONG
^
/Users/nii/.pyenv/versions/2.7.6/include/python2.7/pymacconfig.h:43:17: note: previous definition is here
# define SIZEOF_SIZE_T 8
^
In file included from _mysql.c:44:
/usr/local/Cellar/mysql/5.6.23/include/mysql/my_config.h:442:9: warning: 'HAVE_WCSCOLL' macro redefined [-Wmacro-redefined]
#define HAVE_WCSCOLL
^
/Users/nii/.pyenv/versions/2.7.6/include/python2.7/pyconfig.h:908:9: note: previous definition is here
#define HAVE_WCSCOLL 1
^
_mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (how < 0 || how >= sizeof(row_converters)) {
~~~ ^ ~
3 warnings generated.
clang -bundle -bundle_loader python.exe -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/nii/.pyenv/versions/2.7.6/lib build/temp.macosx-10.10-x86_64-2.7/_mysql.o -L/usr/local/Cellar/mysql/5.6.23/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.10-x86_64-2.7/_mysql.so
ld: file not found: python.exe
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Users/nii/.pyenv/versions/project_name/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/kp/c6tk2jws71xcncdjhsj7ww8r_shv_8/T/pip-build-w4jYAD/MySQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/kp/c6tk2jws71xcncdjhsj7ww8r_shv_8/T/pip-TU73Hn-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/nii/.pyenv/versions/project_name/include/site/python2.7/MySQL-python" failed with error code 1 in /private/var/folders/kp/c6tk2jws71xcncdjhsj7ww8r_shv_8/T/pip-build-w4jYAD/MySQL-python
Il semble que paramiko n'ait pas été inclus dans les problèmes liés. Il y avait d'autres bibliothèques que je n'ai pas pu installer, bien que je ne les énumère pas ici.
Le problème vient de la version de python. La version de python dans l'environnement qui a donné cette erreur était 2.7.6. Si vous effectuez une mise à niveau vers 2.7.8 ou une version ultérieure, vous pouvez inclure la bibliothèque.
I confirmed same happens on my OS X 10.10.1, at least, with CPython 2.7.6 and 2.7.7. This might be a build issue of paramiko package itself, though, I couldn't find any related issues on the project. Upgrading to CPython 2.7.8 will fix the issue.
La solution est écrite en anglais sur le lien, donc si vous la lisez calmement, vous pouvez atteindre la solution.
Recommended Posts