idf_tools.py: fix virtualenv issue for macOS with homebrew
This commit is contained in:
parent
f61fd8a664
commit
9279b72a6c
1 changed files with 5 additions and 0 deletions
|
@ -1315,6 +1315,11 @@ def main(argv):
|
||||||
global global_idf_tools_path
|
global global_idf_tools_path
|
||||||
global_idf_tools_path = os.environ.get('IDF_TOOLS_PATH') or os.path.expanduser(IDF_TOOLS_PATH_DEFAULT)
|
global_idf_tools_path = os.environ.get('IDF_TOOLS_PATH') or os.path.expanduser(IDF_TOOLS_PATH_DEFAULT)
|
||||||
|
|
||||||
|
# On macOS, unset __PYVENV_LAUNCHER__ variable if it is set.
|
||||||
|
# Otherwise sys.executable keeps pointing to the system Python, even when a python binary from a virtualenv is invoked.
|
||||||
|
# See https://bugs.python.org/issue22490#msg283859.
|
||||||
|
os.environ.pop('__PYVENV_LAUNCER__', None)
|
||||||
|
|
||||||
if sys.version_info.major == 2:
|
if sys.version_info.major == 2:
|
||||||
try:
|
try:
|
||||||
global_idf_tools_path.decode('ascii')
|
global_idf_tools_path.decode('ascii')
|
||||||
|
|
Loading…
Reference in a new issue