mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-04-13 22:02:56 +00:00
Update utilities.py
This commit is contained in:
parent
b0caa9804d
commit
89102b9c01
@ -38,13 +38,14 @@ import git
|
||||
|
||||
import mimetypes
|
||||
import subprocess
|
||||
from conda.cli.python_api import run_command, Commands
|
||||
|
||||
def create_conda_env(env_name, python_version):
|
||||
from conda.cli.python_api import run_command, Commands
|
||||
# Create a new Conda environment with the specified Python version
|
||||
run_command(Commands.CREATE, "-n", env_name, f"python={python_version}")
|
||||
|
||||
def run_python_script_in_env(env_name, script_path, cwd=None):
|
||||
from conda.cli.python_api import run_command, Commands
|
||||
# Set the current working directory if provided, otherwise use the current directory
|
||||
if cwd is None:
|
||||
cwd = os.getcwd()
|
||||
@ -53,6 +54,7 @@ def run_python_script_in_env(env_name, script_path, cwd=None):
|
||||
run_command(Commands.RUN, "-n", env_name, "python", str(script_path), cwd=cwd)
|
||||
|
||||
def run_script_in_env(env_name, script_path, cwd=None):
|
||||
from conda.cli.python_api import run_command, Commands
|
||||
# Set the current working directory if provided, otherwise use the current directory
|
||||
if cwd is None:
|
||||
cwd = os.path.dirname(script_path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user