2017-09-20 49 views
0

以下是我試圖安裝要求:的MySQL相關的庫沒有得到安裝了PIP在python3

Django==1.9.6 
gunicorn==17.5 
gevent 
Flask==0.11 
Flask-SQLAlchemy==2.1 
Flask-OAuth==0.12 
Jinja2==2.8 
MarkupSafe==0.23 
MySQL-python==1.2.4b4 
itsdangerous==0.24 
nltk==3.2 
numpy==1.8.2 
oauth2==1.9.0.post1 
oauthlib==0.6.1 
pandas==0.13.1 
pyOpenSSL==0.13 
pycurl==7.19.3 
requests==2.2.1 
scikit-learn==0.14.1 
scipy==0.13.3 
simplejson==3.3.1 
psycopg2==2.6.1 
SQLAlchemy==1.0.12 
Werkzeug==0.11.9 
redis==2.10.5 

我用命令:

pip install -r requirements.txt 

以下是遇到的錯誤:

Collecting Django==1.9.6 (from -r requirements.txt (line 1)) 
    Using cached Django-1.9.6-py2.py3-none-any.whl 
Collecting gunicorn==17.5 (from -r requirements.txt (line 2)) 
    Using cached gunicorn-17.5.tar.gz 
Collecting gevent (from -r requirements.txt (line 3)) 
    Using cached gevent-1.2.2-cp35-cp35m-win_amd64.whl 
Collecting Flask==0.11 (from -r requirements.txt (line 4)) 
    Using cached Flask-0.11-py2.py3-none-any.whl 
Collecting Flask-SQLAlchemy==2.1 (from -r requirements.txt (line 5)) 
    Using cached Flask-SQLAlchemy-2.1.tar.gz 
Requirement already satisfied: Flask-OAuth==0.12 in c:\python35\lib\site-packages (from -r requirements.txt (line 6)) 
Collecting Jinja2==2.8 (from -r requirements.txt (line 7)) 
    Using cached Jinja2-2.8-py2.py3-none-any.whl 
Collecting MarkupSafe==0.23 (from -r requirements.txt (line 8)) 
    Using cached MarkupSafe-0.23.tar.gz 
Collecting MySQL-python==1.2.4b4 (from -r requirements.txt (line 9)) 
    Using cached MySQL-python-1.2.4b4.zip 
    Complete output from command python setup.py egg_info: 
    Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz 
    Extracting in C:\Users\LENOVO~1\AppData\Local\Temp\tmpgw32ylav 
    Traceback (most recent call last): 
     File "C:\Users\LENOVO~1\AppData\Local\Temp\pip-build-3n4ps1ef\MySQL-python\distribute_setup.py", line 143, in use_setuptools 
     raise ImportError 
    ImportError 

    During handling of the above exception, another exception occurred: 

    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "C:\Users\LENOVO~1\AppData\Local\Temp\pip-build-3n4ps1ef\MySQL-python\setup.py", line 7, in <module> 
     use_setuptools() 
     File "C:\Users\LENOVO~1\AppData\Local\Temp\pip-build-3n4ps1ef\MySQL-python\distribute_setup.py", line 145, in use_setuptools 
     return _do_download(version, download_base, to_dir, download_delay) 
     File "C:\Users\LENOVO~1\AppData\Local\Temp\pip-build-3n4ps1ef\MySQL-python\distribute_setup.py", line 125, in _do_download 
     _build_egg(egg, tarball, to_dir) 
     File "C:\Users\LENOVO~1\AppData\Local\Temp\pip-build-3n4ps1ef\MySQL-python\distribute_setup.py", line 99, in _build_egg 
     _extractall(tar) 
     File "C:\Users\LENOVO~1\AppData\Local\Temp\pip-build-3n4ps1ef\MySQL-python\distribute_setup.py", line 486, in _extractall 
     self.chown(tarinfo, dirpath) 
    TypeError: chown() missing 1 required positional argument: 'numeric_owner' 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in C:\Users\LENOVO~1\AppData\Local\Temp\pip-build-3n4ps1ef\MySQL-python\ 

我正在使用Windows 10操作系統和Python3.5。

請幫助我。

回答

1

這不是一個直接解決這個問題的方法,但是還有其他的MySQL庫,如果你的解決方案不一定需要使用這個庫,那麼這些庫可以幫助你跳過這個問題。例如,您可以嘗試pymysql

+0

我想從Github運行一個存儲庫,它有這些要求。但是,如果那個人已經與這些圖書館的要求制定出了什麼,那麼我爲什麼會對我的情況感到困擾呢? –

+1

最常見的原因是作者沒有使用您的環境進行測試 - 沒有使用Windows或您的Python版本進行測試。相同的安裝可能適用於Linux或其他版本的Windows。 –

+0

謝謝你的回覆。我將嘗試在我的虛擬盒子中使用Ubuntu。 –

1

MySQL-python與我在pypi上看到的不是python3兼容。

+0

是嗎?那麼該庫與其他版本的python兼容如2.7?我個人不願意使用Python 2.7,因爲我的項目中有整個python3.5作爲依賴項。但如果這是唯一的解決方案,那麼我想我需要按Python2.7 –

+1

編碼所有內容。正如Chris所述。你可以試試pymysql。從看GitHub,它的目標是成爲一個直接替代品。 https://github.com/PyMySQL/PyMySQL – Kyle

+0

謝謝你的回覆我會檢查它。如果可能,還會嘗試將環境更改爲Linux Ubuntu。 –