Mac pip install mysql-python unsuccessful

后端 未结 6 1039
一个人的身影
一个人的身影 2020-12-08 23:21

I installed MySQL and Workbench from website. I have a django project whose requirements.txt:

Django==1.11.12
djangorestframework==3.8.2
django-cors-headers=         


        
6条回答
  •  自闭症患者
    2020-12-08 23:48

    Please, try:

    CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments pip install -r requirements.txt
    

    If it does not work: First install mysql-connector-c

    brew install mysql-connector-c 
    pip install MySQL-python
    

    If you are using Windows:

    https://dev.mysql.com/downloads/connector/c/

    You can also check what happend when you try install it with pip3.

    UPDATE: If you have Linux: Please open the /usr/local/bin/mysql_config.

    And then:

    #Create options
    Libs = "-L $ pkglibdir "
    Libs = " $ libs   -l"
    

    replace with:

    #Create options
    Libs = "- L $ pkglibdir"
    Libs = "$ libs -lmysqlclient -lssl -lcrypto"
    

    Save it and reinstall mysql-python.

    pip uninstall mysql-python
    pip install mysql-python
    

    For Mac:

    LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysql-python
    

    should be helpful.

提交回复
热议问题