Bei der Verwendung von pyenv unter Mac OS X Yosemite (10.10 oder höher) bin ich auf eine Bibliothek gestoßen, die ich nicht per Pip installieren kann.
Probleme und Lösungen finden Sie bereits unter https://github.com/yyuu/pyenv/issues/273.
Es ist Englisch, also als ich ungeduldig war, konnte ich überhaupt nicht in den Sinn kommen, und manchmal war ich vom Schlamm begeistert, also schreibe ich es hier auf Japanisch.
Wenn ich versuche, MySQL-Python einzuschließen, wird folgende Fehlermeldung angezeigt:
$ 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
Es scheint, dass paramiko nicht in den verknüpften Themen enthalten war. Es gab einige andere Bibliotheken, die ich nicht installieren konnte, obwohl ich sie hier nicht auflisten werde.
Das Problem ist mit der Version von Python. Die Version von Python in der Umgebung, die diesen Fehler verursachte, war 2.7.6. Wenn Sie auf 2.7.8 oder höher aktualisieren, können Sie die Bibliothek einschließen.
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.
Die Lösung ist unter dem Link in englischer Sprache verfasst. Wenn Sie sie also ruhig lesen, können Sie die Lösung erreichen.
Recommended Posts