python - 數據庫操作(mysqlclient) - 安裝


1. windows環境:

pycharm中,terminal使用以下命令:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests mysqlclient

 

排坑:

安裝了一個3.8版本的Python,折騰了一天,怎么都裝不上。換成Python3.7, ok~

 

 

2. mac環境

mac上執行pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests mysqlclient報錯如下:

 解決步驟:

1)打開終端,安裝mysql-connector-c

brew install mysql-connector-c

此過程較慢,大約會持續2個小時左右

2)在~/.bash_profile中加入mysql.的路徑

export PATH=${PATH}:/usr/local/Cellar/mysql-client/8.0.19/bin/
source .bash_profile # 使配置文件生效

3)安裝mysqlclient

pip3 install mysqlclient

4) 創建軟鏈接

ln -s /usr/local/Cellar/mysql-client/8.0.19/bin/mysql_config /usr/local/bin/mysql_config

5)再次安裝,成功~

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM