Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
200 views
in Technique[技术] by (71.8m points)

Problem with importing python modules on Atom

Upon trying to use the requests module I just downloaded, Atom displayed an error message that stated the module cannot be found. However, in the Mac OS terminal, the module is imported with no problem.

I looked at the results I obtained after calling sys.path, and it seems that the Atom text editor is using Python2.7 whereas the module is downloaded to Python3 folder. How do I change this?

I have already changed the script package's default version to python3 as described here.

The problem seems to be in the interpreter path. When I call sys.path in the terminal, I get this:

terminal path

But on Atom, I get:

['/Users/berk/Desktop/Vaccine',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/Library/Python/2.7/site-packages', 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']
question from:https://stackoverflow.com/questions/65876556/problem-with-importing-python-modules-on-atom

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...