77def is_conda_installed ():
88 return os .path .isdir (os .path .expanduser ("~/miniconda3" ))
99
10+
1011def install_conda (version ):
1112 os_name = platform .system ()
1213 architecture = platform .machine ()
@@ -15,7 +16,9 @@ def install_conda(version):
1516 if os_name == "Darwin" :
1617 if architecture == "arm64" :
1718 # arm64 installer for Apple Silicon
18- print ("Detected arm64 architecture. Using arm-specific Miniconda installer." )
19+ print (
20+ "Detected arm64 architecture. Using arm-specific Miniconda installer."
21+ )
1922 installer_url = f"https://repo.anaconda.com/miniconda/Miniconda3-{ version } -MacOSX-arm64.sh"
2023 else :
2124 # x86_64 installer for Intel Macs
@@ -24,7 +27,9 @@ def install_conda(version):
2427 elif os_name == "Linux" :
2528 # Linux installer
2629 print ("Detected Linux. Using Linux Miniconda installer." )
27- installer_url = f"https://repo.anaconda.com/miniconda/Miniconda3-{ version } -Linux-x86_64.sh"
30+ installer_url = (
31+ f"https://repo.anaconda.com/miniconda/Miniconda3-{ version } -Linux-x86_64.sh"
32+ )
2833 else :
2934 print ("Unsupported operating system." )
3035 sys .exit (1 )
@@ -33,7 +38,9 @@ def install_conda(version):
3338 # Download installer
3439 subprocess .run (["curl" , "-o" , installer_path , installer_url ], check = True )
3540 # Install Miniconda
36- subprocess .run (["bash" , installer_path , "-b" , "-u" , "-p" , f"{ home_dir } /miniconda3" ], check = True )
41+ subprocess .run (
42+ ["bash" , installer_path , "-b" , "-u" , "-p" , f"{ home_dir } /miniconda3" ], check = True
43+ )
3744 # Remove installer
3845 os .remove (installer_path )
3946
@@ -51,6 +58,7 @@ def install_conda(version):
5158 subprocess .run (["bash" , "-c" , "source ~/.bashrc" ], check = True )
5259 print ("Conda installation completed and added to PATH." )
5360
61+
5462def main (version ):
5563 print ("Checking conda installation for Python 3 (64-bit)..." )
5664 if not is_conda_installed ():
@@ -59,7 +67,7 @@ def main(version):
5967 else :
6068 print ("Conda is already installed." )
6169
70+
6271if __name__ == "__main__" :
6372 version = "py311_24.7.1-0"
6473 main (version )
65-
0 commit comments