簡體   English   中英

我怎么能在我嘗試輸入pip install mysql-python的時候修復這個錯誤

[英]How can I fix this error very time I try type pip install mysql-python

我一直在嘗試在mac上安裝python-MySQLdb而且我一直在收到錯誤。 我已經嘗試了很多替代方法來傳遞這個錯誤。

sudo PATH=/usr/local/Cellar/mysql/bin/:$PATH pip install mysql-python
Password:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
The directory '/Users/zuhairhallak/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/zuhairhallak/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting mysql-python
  Downloading https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
    100% |████████████████████████████████| 112kB 2.6MB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-install-RtF2js/mysql-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 53, in get_config
        libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
      File "setup_posix.py", line 8, in dequote
        if s[0] in "\"'" and s[0] == s[-1]:
    IndexError: string index out of range

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-RtF2js/mysql-python/

我也運行了sudo -H pip install mysql-python,我得到了不同的錯誤

產生了13個警告。 cc -bundle -undefined dynamic_lookup -Wl,-F。 build / temp.macosx-10.14-intel-2.7 / _mysql.o -L / usr / local / Cellar / mysql / 8.0.15 / lib -lmysqlclient -lssl -lcrypto -o build / lib.macosx-10.14-intel-2.7 /_mysql.so ld:找不到-lssl clang的庫:錯誤:鏈接器命令失敗,退出代碼為1(使用-v查看調用)錯誤:命令'cc'失敗,退出狀態為1


mysql-python構建輪失敗運行setup.py clean for mysql-python構建mysql-python失敗安裝收集的軟件包:mysql-python運行mysql-python的setup.py install ...錯誤命令/ usr / bin完成輸出/ python -u -c“import setuptools,tokenize; file ='/ private / tmp / pip-install-3A8kOd / mysql-python / setup.py'; f = getattr(tokenize,'open',open)( file ) ; code = f.read()。replace('\\ r \\ n','\\ n'); f.close(); exec(compile(code, file ,'exec'))“install --record / private /tmp/pip-record-TUb4up/install-record.txt --single-version-external-managed --compile

請試試

brew install mysql
sudo -H pip install mysql-python

我轉到mysql_config文件並打開它

vi mysql_config

這是對的。

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

在終端1中運行此命令.export LDFLAGS =“ - L / usr / local / opt / openssl / lib”2。導出CPPFLAGS =“ - I / usr / local / opt / openssl / include”3。pip install mysql-python

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM