mirror of https://github.com/Jittor/Jittor
fix windows virtual env bug
This commit is contained in:
parent
3bcdfc97a9
commit
5cf9c10c92
|
@ -9,7 +9,7 @@
|
||||||
# file 'LICENSE.txt', which is part of this source code package.
|
# file 'LICENSE.txt', which is part of this source code package.
|
||||||
# ***************************************************************
|
# ***************************************************************
|
||||||
|
|
||||||
__version__ = '1.3.7.7'
|
__version__ = '1.3.7.8'
|
||||||
from jittor_utils import lock
|
from jittor_utils import lock
|
||||||
with lock.lock_scope():
|
with lock.lock_scope():
|
||||||
ori_int = int
|
ori_int = int
|
||||||
|
|
|
@ -1098,10 +1098,7 @@ if os.name == 'nt':
|
||||||
if cc_type == 'g++':
|
if cc_type == 'g++':
|
||||||
pass
|
pass
|
||||||
elif cc_type == 'cl':
|
elif cc_type == 'cl':
|
||||||
py3_link_path = os.path.join(
|
py3_link_path = jit_utils.get_py3_link_path()
|
||||||
os.path.dirname(sys.executable),
|
|
||||||
"libs",
|
|
||||||
)
|
|
||||||
cc_flags = remove_flags(cc_flags, ["-f", "-m"])
|
cc_flags = remove_flags(cc_flags, ["-f", "-m"])
|
||||||
cc_flags = cc_flags.replace("-std=c++14", "-std=c++17")
|
cc_flags = cc_flags.replace("-std=c++14", "-std=c++17")
|
||||||
cc_flags = cc_flags.replace("-lstdc++", "")
|
cc_flags = cc_flags.replace("-lstdc++", "")
|
||||||
|
|
|
@ -445,6 +445,20 @@ def get_cc_type(cc_path):
|
||||||
if "cl" in bname: return "cl"
|
if "cl" in bname: return "cl"
|
||||||
LOG.f(f"Unknown cc type: {bname}")
|
LOG.f(f"Unknown cc type: {bname}")
|
||||||
|
|
||||||
|
def get_py3_link_path():
|
||||||
|
py3_link_path = os.path.join(
|
||||||
|
os.path.dirname(sys.executable),
|
||||||
|
"libs",
|
||||||
|
)
|
||||||
|
if not os.path.exists(py3_link_path):
|
||||||
|
candidate = [os.path.dirname(sys.executable)] + sys.path
|
||||||
|
for p in candidate:
|
||||||
|
p = os.path.join(p, "libs")
|
||||||
|
if os.path.exists(p):
|
||||||
|
py3_link_path = p
|
||||||
|
break
|
||||||
|
return py3_link_path
|
||||||
|
|
||||||
def get_py3_config_path():
|
def get_py3_config_path():
|
||||||
global _py3_config_path
|
global _py3_config_path
|
||||||
if _py3_config_path:
|
if _py3_config_path:
|
||||||
|
@ -502,10 +516,14 @@ def get_py3_include_path():
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
# Windows
|
# Windows
|
||||||
sys.executable = sys.executable.lower()
|
sys.executable = sys.executable.lower()
|
||||||
_py3_include_path = '-I"' + os.path.join(
|
candidate = [os.path.dirname(sys.executable)] + sys.path
|
||||||
os.path.dirname(sys.executable),
|
for p in candidate:
|
||||||
"include"
|
include_path = os.path.join(p, "include")
|
||||||
) + '"'
|
if os.path.exists(include_path):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise RuntimeError("Python include path not found. please report this bug to us.")
|
||||||
|
_py3_include_path = '-I"' + include_path + '"'
|
||||||
else:
|
else:
|
||||||
_py3_include_path = run_cmd(get_py3_config_path()+" --includes")
|
_py3_include_path = run_cmd(get_py3_config_path()+" --includes")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue