Python Idle import third-party module in MAC system successful, ecplise import Python third-party module failure resolution method

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.