Skip to content

Commit

Permalink
Change sys.executable to python executable inside venv (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko authored Mar 3, 2025
1 parent b81e005 commit 52a9a85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/pythonx.ex
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ defmodule Pythonx do
# located in `{python_home_path}/lib/pythonx.y` (Linux and macOS)
# or `{python_home_path}/Lib` (Windows).
#
# `python_executable_path` is the Python executable file.
# `python_executable_path` is the Python executable file. When using
# venv, it is preferable to point to an executable in the venv
# directory, which is relevant if additional packages are installed
# at runtime.
#
# ## Options
#
Expand Down
6 changes: 3 additions & 3 deletions lib/pythonx/uv.ex
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ defmodule Pythonx.Uv do
python_home_path = make_windows_slashes(root_dir)

python_executable_path =
abs_executable_dir
|> Path.join("python.exe")
project_dir
|> Path.join(".venv/Scripts/python.exe")
|> make_windows_slashes()

venv_packages_path =
Expand All @@ -135,7 +135,7 @@ defmodule Pythonx.Uv do

python_home_path = root_dir

python_executable_path = Path.join(abs_executable_dir, "python")
python_executable_path = Path.join(project_dir, ".venv/bin/python")

venv_packages_path =
project_dir
Expand Down

0 comments on commit 52a9a85

Please sign in to comment.