简体   繁体   English

使用conda安装flask-mysql

[英]installing flask-mysql using conda

How should I install flask-mysql using conda? 我应该如何使用conda安装flask-mysql?

Monas-MacBook-Pro:flask_app mona$ conda install -c auto flask-mysql
Fetching package metadata .............

PackageNotFoundError: Packages missing in current channels:

  - flask-mysql

We have searched for the packages in the following channels:

  - https://conda.anaconda.org/auto/osx-64
  - https://conda.anaconda.org/auto/noarch
  - https://repo.continuum.io/pkgs/main/osx-64
  - https://repo.continuum.io/pkgs/main/noarch
  - https://repo.continuum.io/pkgs/free/osx-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/osx-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/osx-64
  - https://repo.continuum.io/pkgs/pro/noarch

I can install it using pip but I wonder if there's a hack to install it using conda as well: 我可以使用pip来安装它,但我想知道是否也可以使用conda来安装它:

Monas-MacBook-Pro:flask_app mona$ pip -V
pip 9.0.1 from /Users/mona/anaconda/lib/python3.6/site-packages (python 3.6)
Monas-MacBook-Pro:flask_app mona$ pip install flask-mysql

Installing flask-mysql using the command conda install -c auto flask-mysql is currently only supported by Linux. 安装flask-mysql使用命令conda install -c auto flask-mysql目前仅支持Linux。 If you check this link , you'll find this package is only available for linux-32 and linux-64 如果您检查此链接 ,则会发现此软件包仅适用于linux-32和linux-64

I am assuming you want to install a database toolkit for Flask. 我假设您想为Flask安装数据库工具包。 May I suggest you use SQLAlchemy ? 我可以建议您使用SQLAlchemy吗? It supports MySQL starting with version 4.1 through modern releases. 它支持从4.1版到最新发行版的MySQL。 Follow this link for more details: http://docs.sqlalchemy.org/en/latest/dialects/mysql.html 单击此链接以获取更多详细信息: http : //docs.sqlalchemy.org/en/latest/dialects/mysql.html

The conda command to install Flask and SQLAlchemy is: 安装Flask和SQLAlchemy的conda命令为:

conda install -c conda-forge flask-sqlalchemy

Or, to get python + flask + mysql working on Mac you can simply type in these commands: 或者,要使python + flask + mysql在Mac上运行,您只需输入以下命令:

pip install flask

Then, 然后,

sudo su
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
pip install MySQL-python

Finally, make a symlink 最后,进行符号链接

cd /usr/local
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

I hope this helps! 我希望这有帮助! :) :)

I can confirm that if you install with pip install flask-mysql , you will be able to import the package from within your flask environment (after the source activate command). 我可以确认,如果使用pip install flask-mysql ,则可以从flask环境中导入软件包(在source activate命令之后)。 There is no working conda install package for it. 没有适用的conda安装软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM