Encounter a more tangled 4 months of the problem, has not cared, today really can not endure, try various solutions, finally put this annoying problem perfect solution, dare not exclusive, write to share with you big God.
Problem: The Python third-party module is installed under Mac OSX, MySQLdb, XLRT, XLWT, selenium, and so on, can import these modules successfully in Python idle, but the missing in eclipse always cannot be imported, prompting "No module named xxxx".
In the online and various PYTHONQQ groups to search for a variety of solutions, no fruit, the group also has a big God said that the Apple system does not have to win to become, good worry Mulberry Qaq, but I did not believe him. Eclipse and the same third-party module are then installed in the Win7 virtual machine, and the modules are imported into eclipse for normal use. So I will win the following modules of the installation path and the installation path under the Mac to make a comparison, win under the third-party module installation path is in C:\Python27\Lib\site-packages, and the Mac is installed to the /library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages path, not python_home/lib/ Site-packages directory, then put /library k/versions/2.7/lib/ Python2.7/site-packages path All things copy/library/python/2.7/site-packages, reopen Eclipse, create a new Python file,
From selenium import Webdriver
Driver = Webdriver. Firefox ()
Driver.get (' http://www.baidu.com ')
Print Driver.title
Driver.close ()
Opened Firefox, and opened Baidu, the output of the title
OK, you are done.
Steps:
1, first find the third-party module installation path, for example:/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages
2, find the Python installation directory, for example:/library/python/2.7/ can
Import Sys
Print Sys.path View
3. CD /library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages
sudo cp-r * /library/python/2.7/site-packages
4. Restart Eclipse
This article is from the "8566740" blog, please be sure to keep this source http://8576740.blog.51cto.com/8566740/1604846
Python Idle import third-party module in MAC system successful, ecplise import Python third-party module failure resolution method