簡體   English   中英

在osx上為django在virtualenv中安裝mysql

[英]installing mysql in virtualenv on osx for django

我一直在嘗試為我的django項目安裝mysql。我正在運行osx yosemite 10.10和django = 1.7,python 2.7,以及虛擬環境。 當我試圖運行pip install MySQL-python然后出現以下錯誤:

You are using pip version 6.0.8, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
DEPRECATION: --no-install and --no-download are deprecated. See  https://github.com/pypa/pip/issues/906.
Collecting MySQL-python
Using cached MySQL-python-1.2.5.zip
sh: mysql_config: command not found
 Traceback (most recent call last):
  File "<string>", line 20, in <module>
  File "/Volumes/DiskSecond/pythonsNest/env2/build/MySQL-python/setup.py", line 17, in <module>
    metadata, options = get_config()
  File "setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "setup_posix.py", line 25, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found

Traceback (most recent call last):

  File "<string>", line 20, in <module>

  File "/Volumes/DiskSecond/pythonsNest/env2/build/MySQL-python/setup.py", line 17, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 25, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

  EnvironmentError: mysql_config not found

  ----------------------------------------
  Command "python setup.py egg_info" failed with error code 1 in /Volumes/DiskSecond/pythonsNest/env2/build/MySQL-python

我已經在我的系統上全局安裝了python,但django安裝在名為== env2的virtualenv中。 當我檢查我的env2的構建文件夾然后已經有一個名為s的文件夾存在所有的mysql文件。但是當使用pip安裝它時仍然出現錯誤。這是問題嗎?

你需要在你的控制台中執行此操作:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后

brew install mysql
pip install mysql-python

暫無
暫無

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

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