Skip to content

Commit 52a9a85

Browse files
Change sys.executable to python executable inside venv (#14)
1 parent b81e005 commit 52a9a85

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/pythonx.ex

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ defmodule Pythonx do
7676
# located in `{python_home_path}/lib/pythonx.y` (Linux and macOS)
7777
# or `{python_home_path}/Lib` (Windows).
7878
#
79-
# `python_executable_path` is the Python executable file.
79+
# `python_executable_path` is the Python executable file. When using
80+
# venv, it is preferable to point to an executable in the venv
81+
# directory, which is relevant if additional packages are installed
82+
# at runtime.
8083
#
8184
# ## Options
8285
#

lib/pythonx/uv.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ defmodule Pythonx.Uv do
107107
python_home_path = make_windows_slashes(root_dir)
108108

109109
python_executable_path =
110-
abs_executable_dir
111-
|> Path.join("python.exe")
110+
project_dir
111+
|> Path.join(".venv/Scripts/python.exe")
112112
|> make_windows_slashes()
113113

114114
venv_packages_path =
@@ -135,7 +135,7 @@ defmodule Pythonx.Uv do
135135

136136
python_home_path = root_dir
137137

138-
python_executable_path = Path.join(abs_executable_dir, "python")
138+
python_executable_path = Path.join(project_dir, ".venv/bin/python")
139139

140140
venv_packages_path =
141141
project_dir

0 commit comments

Comments
 (0)