Skip to content

Commit e4d33d8

Browse files
committed
Support C++ import python on windows for paddle
1 parent 7c90a4d commit e4d33d8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

python/paddle/dataset/image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@
4040
import subprocess
4141
import sys
4242
if sys.platform == 'win32':
43-
interpreter = sys.exec_prefix + "\\" + "python"
43+
interpreter = sys.exec_prefix + "\\" + "python.exe"
4444
else:
4545
interpreter = sys.executable
4646
import_cv2_proc = subprocess.Popen(
4747
[interpreter, "-c", "import cv2"],
4848
stdout=subprocess.PIPE,
4949
stderr=subprocess.PIPE)
50+
out, err = import_cv2_proc.communicate()
5051
retcode = import_cv2_proc.poll()
5152
if retcode != 0:
5253
cv2 = None

python/paddle/fluid/tests/unittests/cc_imp_py_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ TEST(CC, IMPORT_PY) {
2222
ASSERT_TRUE(Py_IsInitialized());
2323

2424
// 1. C/C++ Run Python simple string
25-
std::cout << PyRun_SimpleString("import paddle");
25+
ASSERT_FALSE(PyRun_SimpleString("import paddle"));
2626
ASSERT_FALSE(PyRun_SimpleString("print(paddle.to_tensor(1))"));
2727

2828
// 2. C/C++ Run Python funciton

0 commit comments

Comments
 (0)