问题:在mac OSx操作系统下,安装了python第三方模块,requests、xlrt、xlwt、selenium等等,在pip中可以成功安装这些模块,但是在python中缺始终无法导入,提示“no module named xxxx”。
在python的情况下查看路径为:
requests.__file__
'/Library/Python/2.7/site-packages/requests/__init__.pyc'
但是使用python3 情况为:
>>> import request
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'request'
由此发现是路径的问题,查看系统模型的路径为
>>> os.__file__
'/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py'
使用pip安装一个python3第三方库:sduo python3 -m pip install requests
Successfully installed requests-2.18.4 urllib3-1.22
完美解决问题
————————————————
版权声明:本文为CSDN博主「fei2636」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/fei2636/article/details/77499011