Skip to content

Commit 65dbf46

Browse files
authored
【Hackathon 8th No.7】Python版本适配 4 (#3970)
* Update setup.py * auto scipy * auto matplotlib * Update setup.py * Apply suggestions from code review
1 parent a196c05 commit 65dbf46

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

setup.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,26 @@ def determine_opencc_version():
5151
return "opencc" # default
5252

5353

54+
def determine_scipy_version():
55+
# get python version
56+
python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
57+
58+
# determine scipy version
59+
if python_version == "3.8":
60+
return "scipy>=1.4.0, <=1.12.0" # Python3.8 need scipy>=1.4.0, <=1.12.0
61+
return "scipy" # default
62+
63+
64+
def determine_matplotlib_version():
65+
# get python version
66+
python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
67+
68+
# determine matplotlib version
69+
if python_version == "3.8" or python_version == "3.9":
70+
return "matplotlib<=3.8.4" # Python3.8/9 need matplotlib<=3.8.4
71+
return "matplotlib" # default
72+
73+
5474
base = [
5575
"braceexpand",
5676
"editdistance",
@@ -63,9 +83,9 @@ def determine_opencc_version():
6383
# paddleaudio align with librosa==0.8.1, which need numpy==1.23.x
6484
"numpy==1.23.5",
6585
"librosa==0.8.1",
66-
"scipy>=1.4.0, <=1.12.0",
86+
determine_scipy_version(), # scipy or scipy>=1.4.0, <=1.12.0
6787
"loguru",
68-
"matplotlib<=3.8.4",
88+
determine_matplotlib_version(), # matplotlib or matplotlib<=3.8.4
6989
"nara_wpe",
7090
"onnxruntime>=1.11.0",
7191
determine_opencc_version(), # opencc or opencc==1.1.6
@@ -92,7 +112,7 @@ def determine_opencc_version():
92112
"ToJyutping",
93113
"typeguard",
94114
"webrtcvad",
95-
"yacs~=0.1.8",
115+
"yacs>=0.1.8",
96116
"zhon",
97117
]
98118

0 commit comments

Comments
 (0)