1. kasyun

    No comment

    kasyun
Changes in tags
Changes in body
Source | HTML | Preview
@@ -1,274 +1,274 @@
# 要約
2017/12/21現在
実行ファイル(lambda_function.py等)の一つ上のディレクトリで、↓を動かすだけ。
```sh
$ pip install mysql-connector-python -t .
```
毎回毎回毎回毎回毎回毎回毎回毎回毎回ひたすらハマるので備忘録です。
## ディレクトリ構造
```sh
/home/ec2-user/environment
|--MysqlInstallTest
| |--.application.json
| |--.gitignore
| |--MysqlInstallTest
| | |--lambda_function.py
| |--template.yaml
|--README.md
```
# ハマりどころ
## ❌インストールするディレクトリ指定無し
```sh
$ pip install mysql-connector-python
```
## ❌インストールするディレクトリを間違っちゃう
lambda_function.pyの一つ上が正しいです。
(PythonのPackageのパス読込みに対する学びが足りていない感…。)
OK
* /home/ec2-user/environment/MysqlInstallTest
NG
* /home/ec2-user/environment
* /home/ec2-user/environment/MysqlInstallTest/MysqlInstallTest
-# ❌mysql-connector-python-rfを使っちゃう
+## ❌mysql-connector-python-rfを使っちゃう
```sh
$ pip install mysql-connector-python -t .
```
https://pypi.python.org/pypi/mysql-connector-python/8.0.5
https://pypi.python.org/pypi/mysql-connector-python-rf
見比べてもどう違うか分かりませんでした。
Package Index Ownerが違う…?
とりあえずこっちはダメだったので放置ですが、どなたか違いをご教授ください。
# 確認ソース
```py3
import mysql.connector
def lambda_handler(event, context):
print(mysql.connector.__file__)
return ''
```
![image.png](https://qiita-image-store.s3.amazonaws.com/0/22247/f4cfbffe-3a90-4786-1c90-032e4d145704.png)
# 全ログ
```sh
ec2-user:~/environment $ pwd;find . | sort | sed '1d;s/^\.//;s/\/\([^/]*\)$/|--\1/;s/\/[^/|]*/| /g'
/home/ec2-user/environment
|--.c9
| |--metadata
| | |--environment
| | | |--MysqlInstallTest
| | | | |--MysqlInstallTest
| | | | | |--lambda_function.py
| | |--tab0
| | |--tab1
| |--.nakignore
| |--project.settings
| |--tmp
| | |--MysqlInstallTest
|--MysqlInstallTest
| |--.application.json
| |--.gitignore
| |--MysqlInstallTest
| | |--lambda_function.py
| |--template.yaml
|--README.md
ec2-user:~/environment $ cd MysqlInstallTest/
ec2-user:~/environment/MysqlInstallTest $ pip install mysql-connector-python -t .
Collecting mysql-connector-python
Downloading mysql_connector_python-8.0.5-cp27-cp27mu-manylinux1_x86_64.whl (8.2MB)
100% |████████████████████████████████| 8.2MB 138kB/s
Installing collected packages: mysql-connector-python
Successfully installed mysql-connector-python-8.0.5
ec2-user:~/environment/MysqlInstallTest $ pwd;find . | sort | sed '1d;s/^\.//;s/\/\([^/]*\)$/|--\1/;s/\/[^/|]*/| /g'
/home/ec2-user/environment/MysqlInstallTest
|--.application.json
|--.gitignore
|--mysql
| |--connector
| | |--abstracts.py
| | |--abstracts.pyc
| | |--authentication.py
| | |--authentication.pyc
| | |--catch23.py
| | |--catch23.pyc
| | |--charsets.py
| | |--charsets.pyc
| | |--connection_cext.py
| | |--connection_cext.pyc
| | |--connection.py
| | |--connection.pyc
| | |--constants.py
| | |--constants.pyc
| | |--conversion.py
| | |--conversion.pyc
| | |--cursor_cext.py
| | |--cursor_cext.pyc
| | |--cursor.py
| | |--cursor.pyc
| | |--custom_types.py
| | |--custom_types.pyc
| | |--dbapi.py
| | |--dbapi.pyc
| | |--django
| | | |--base.py
| | | |--base.pyc
| | | |--client.py
| | | |--client.pyc
| | | |--compiler.py
| | | |--compiler.pyc
| | | |--creation.py
| | | |--creation.pyc
| | | |--features.py
| | | |--features.pyc
| | | |--__init__.py
| | | |--__init__.pyc
| | | |--introspection.py
| | | |--introspection.pyc
| | | |--operations.py
| | | |--operations.pyc
| | | |--schema.py
| | | |--schema.pyc
| | | |--validation.py
| | | |--validation.pyc
| | |--errorcode.py
| | |--errorcode.pyc
| | |--errors.py
| | |--errors.pyc
| | |--fabric
| | | |--balancing.py
| | | |--balancing.pyc
| | | |--caching.py
| | | |--caching.pyc
| | | |--connection.py
| | | |--connection.pyc
| | | |--__init__.py
| | | |--__init__.pyc
| | |--__init__.py
| | |--__init__.pyc
| | |--locales
| | | |--eng
| | | | |--client_error.py
| | | | |--client_error.pyc
| | | | |--__init__.py
| | | | |--__init__.pyc
| | | |--__init__.py
| | | |--__init__.pyc
| | |--network.py
| | |--network.pyc
| | |--optionfiles.py
| | |--optionfiles.pyc
| | |--pooling.py
| | |--pooling.pyc
| | |--protocol.py
| | |--protocol.pyc
|--mysql_connector_python-8.0.5.dist-info
| |--DESCRIPTION.rst
| |--INSTALLER
| |--METADATA
| |--metadata.json
| |--RECORD
| |--WHEEL
|--_mysql_connector.so
| | |--utils.py
| | |--utils.pyc
| | |--version.py
| | |--version.pyc
| |--__init__.py
| |--__init__.pyc
|--MysqlInstallTest
| |--lambda_function.py
|--mysqlx
| |--authentication.py
| |--authentication.pyc
| |--charsets.py
| |--charsets.pyc
| |--compat.py
| |--compat.pyc
| |--config.py
| |--config.pyc
| |--connection.py
| |--connection.pyc
| |--constants.py
| |--constants.pyc
| |--crud.py
| |--crud.pyc
| |--dbdoc.py
| |--dbdoc.pyc
| |--errorcode.py
| |--errorcode.pyc
| |--errors.py
| |--errors.pyc
| |--expr.py
| |--expr.pyc
| |--helpers.py
| |--helpers.pyc
| |--__init__.py
| |--__init__.pyc
| |--locales
| | |--eng
| | | |--client_error.py
| | | |--client_error.pyc
| | | |--__init__.py
| | | |--__init__.pyc
| | |--__init__.py
| | |--__init__.pyc
|--_mysqlxpb.so
| |--protobuf
| | |--__init__.py
| | |--__init__.pyc
| | |--mysqlx_connection_pb2.py
| | |--mysqlx_connection_pb2.pyc
| | |--mysqlx_crud_pb2.py
| | |--mysqlx_crud_pb2.pyc
| | |--mysqlx_datatypes_pb2.py
| | |--mysqlx_datatypes_pb2.pyc
| | |--mysqlx_expect_pb2.py
| | |--mysqlx_expect_pb2.pyc
| | |--mysqlx_expr_pb2.py
| | |--mysqlx_expr_pb2.pyc
| | |--mysqlx_notice_pb2.py
| | |--mysqlx_notice_pb2.pyc
| | |--mysqlx_pb2.py
| | |--mysqlx_pb2.pyc
| | |--mysqlx_resultset_pb2.py
| | |--mysqlx_resultset_pb2.pyc
| | |--mysqlx_session_pb2.py
| | |--mysqlx_session_pb2.pyc
| | |--mysqlx_sql_pb2.py
| | |--mysqlx_sql_pb2.pyc
| |--protocol.py
| |--protocol.pyc
| |--result.py
| |--result.pyc
| |--statement.py
| |--statement.pyc
|--template.yaml
```
# 謝辞
https://qiita.com/yone098@github/items/bba8a42de6b06e40983b
超絶便利コマンドありがとうございました。