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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • junyuan
    New Member
    • Dec 2017
    • 1

    #1

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

    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:

    ModuleNotFoundE rror: 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('pyth on test.py')

    B=tkinter.Butto n(top,text="hel lo",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\s ite-packages

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

    I tried to import other site-packages in test.py and run via GUI button command, all face the same problem. Any ideas?
Working...