No Module Found, But Site-Packages has already install the Libs #19400
-
I have 2 py files, main call sub. tt_main.py: #!/usr/bin/env python37
import os
import csv
import sys,re
import fileinput
import pandas as pd
import openpyxl
from csv import reader
print('AA')
def test():
os.popen(r"python tt_sub.py","r")
if True:
test() tt_sub.py #!/usr/bin/env python37
import os
import csv
import sys,re
import fileinput
import pandas as pd
import openpyxl
from csv import reader
print('AA') The result :
And if I run tt_sub.py only, just have clear output AA. I have already done the checks below, but so far, none of them get works. Part B: VScode Setting "python.pythonpath": "C:\\Users\\juntizha\\AppData\\Local\\Programs\\Python\\Python37\\python37.exe",
"python.testing.pytestArgs": [
"."
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.autoComplete.addBrackets": true,
"python.autoComplete.extraPaths":
[
"C:/Users/juntizha/AppData/Local/Programs/Python/Python37/Lib/site-packages"
], |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
It's because you're using |
Beta Was this translation helpful? Give feedback.
It's because you're using
popen
to executepython
which has no guarantee of being the same Python as the one you executedtt_main.py
with. If you want to launch a subprocess that uses the same Python as you started with, I would usesubprocess
and specify the binary to use assys.executable
.