MySQLdbをインストールするAnacondaメソッド



Anaconda Method Installing Mysqldb



まず、環境の説明

オペレーティングシステム:Windows10 64ビットオペレーティングシステム、
Anaconda(Python 3.6)がメインバージョンであり、Anaconda 2.7(Python2.7)が補助バージョンとしてインストールされています。

次に、MySQLdbをインストールします

Pythonを使用してmysqlデータベースに接続する場合、実際にはMySQLdbをインストールし、mysql-pythonライブラリをダウンロードしてインストールする必要がありますが、Pythonにインポートされたモジュール名はMySQLdbと呼ばれます。
以下に示すように、conda install mysql-pyhtonによってインストールが正常に完了したため、次のようになります。



(D:Anaconda) C:Usersm1521>conda install mysql-python Fetching package metadata ............... Solving package specifications: . UnsatisfiableError: The following specifications were found to be in conflict: - mysql-python -> python 2.6* - python 3.6* Use 'conda info ' to see the dependencies for each package.

画像
そこで、ドキュメントをダウンロードしてインストールすることにしました。最初にmysql-pythonをダウンロードします。
1.管理者でcmdを開きます

正常に取り付けられたホイールがあるかどうかを確認するための最初のピップリスト、取り付け手順2はありません。正常に取り付けられたホイールは、手順3に進みます。
2.最初にpipコマンドでホイールを取り付けます

プロンプト「pip」が内部コマンドまたは外部コマンドでない場合、実行可能なプログラムまたはバッチファイルではありません。

1 Add the scripts directory of Anaconda3's installation directory (for example, F:Anaconda3Scripts) to the system environment variable path, paying attention to the semicolon. Execute the command again pip install wheel 2 Enter the F:Anaconda3Scripts directory under cmd to execute the command. pip install wheel

3.whlファイルをインストールします

画像

写真を見てください、インストールは成功しました~~~インポートテスト、OK〜
MySQLのダウンロードとインストール(うまく書かれすぎています!):
https://www.cnblogs.com/tyhj-zxp/p/6693046.html