By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,725 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Importing a python module/site-package (e.g. scipy) works from a script (test.py), bu

P: 1
Importing a python site-package (e.g. 'scipy') works fine from a script test.py, but NOT from tkinter button command. When click the button, error shows:

ModuleNotFoundError: No module named 'scipy'

<<test.py>>
import scipy
print ("hello world")

<<GUI.py>>
import sys
import os
import tkinter
top=tkinter.Tk()

def startCamera():
os.system('python test.py')

B=tkinter.Button(top,text="hello",command= startCamera)
B.pack()
top.mainloop()




Both the test.py and GUI.py are in a same folder: C:\Users\Breda\PycharmProjects\face_reg\face

scipy package in: C:\Users\Breda\Anaconda3\Lib\site-packages

sys.path variable contains: C:\Users\Breda\Anaconda3\Lib\site-packages

I tried to import other site-packages in test.py and run via GUI button command, all face the same problem. Any ideas?
Dec 18 '17 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.