From 0aed24b403f155a3c015fe9a96dacc8a04c791af Mon Sep 17 00:00:00 2001 From: nanoric Date: Wed, 15 May 2019 17:22:52 +0800 Subject: [PATCH] [Mod] setup.py: use psycopg2-binary instead of psycopg2, and only install when psycopg2 doesn't exists. --- setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5aa35593..682cd0e9 100644 --- a/setup.py +++ b/setup.py @@ -107,6 +107,15 @@ else: pkgs = find_packages() + +def is_psycopg2_exists(): + try: + import psycopg2 + return True + except ImportError: + return False + + install_requires = [ "PyQt5<5.12", "qdarkstyle", @@ -114,7 +123,6 @@ install_requires = [ "websocket-client", "peewee", "pymysql", - "psycopg2", "mongoengine", "numpy", "pandas", @@ -127,6 +135,9 @@ install_requires = [ "ibapi", "deap" ] +if not is_psycopg2_exists(): + install_requires.append("psycopg2-binary") + if sys.version_info.minor < 7: install_requires.append("dataclasses")