Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 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 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...