"vscode:/vscode.git/clone" did not exist on "8efb921068ef426759453da670289b8564989029"
Commit c38229d4 authored by atalman's avatar atalman Committed by Facebook GitHub Bot
Browse files

Fix windows python 3.8 loading path (#2747)

Summary:
Fix windows python 3.8 loading path

Pull Request resolved: https://github.com/pytorch/audio/pull/2747

Reviewed By: nateanl

Differential Revision: D40264326

Pulled By: nateanl

fbshipit-source-id: f4a24757de7b48c63a7481034eb11fc3ff174327
parent 84187909
...@@ -91,12 +91,16 @@ def _init_extension(): ...@@ -91,12 +91,16 @@ def _init_extension():
# To find cuda related dlls we need to make sure the # To find cuda related dlls we need to make sure the
# conda environment/bin path is configured Please take a look: # conda environment/bin path is configured Please take a look:
# https://stackoverflow.com/questions/59330863/cant-import-dll-module-in-python # https://stackoverflow.com/questions/59330863/cant-import-dll-module-in-python
# Please note: if some path can't be added using add_dll_directory we simply ignore this path
if os.name == "nt" and sys.version_info >= (3, 8) and sys.version_info < (3, 9): if os.name == "nt" and sys.version_info >= (3, 8) and sys.version_info < (3, 9):
env_path = os.environ["PATH"] env_path = os.environ["PATH"]
path_arr = env_path.split(";") path_arr = env_path.split(";")
for path in path_arr: for path in path_arr:
if os.path.exists(path): if os.path.exists(path):
try:
os.add_dll_directory(path) os.add_dll_directory(path)
except Exception:
pass
_load_lib("libtorchaudio") _load_lib("libtorchaudio")
# This import is for initializing the methods registered via PyBind11 # This import is for initializing the methods registered via PyBind11
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment