MAC (Mountain Lion)+Eclipse+python+Django+PyDve+MySQL 开发环境搭建
MAC平台上安装Eclipse+python+Djgano+PyDve 开发环境搭建 比较复杂 我花了好多时间 才安装成功!
主要难点在于:
(一) 多版本的软件安装路径可能有所改变 导致软件之间不能快速的找到你所安装最新版本的路径,假如你所安装的Eclipse没能找到你所安装的Python路径
你需要手动添加Python Intrepreter的路径,我这次安装Python的路径为/usr/local/bin/pythonw 所以一开始EClipse就一直为找到正确的路径,导致编译出错!
(二) MySQl的安装比较费力 主要是除了安装官方提供的两个安装包外 还需要安装python-mysqldb 负责会出现错误!
0.安装JDK
在JDK官网http://www.php.cn/选择合适的版本,注意32位和64位的区别。
Mountain Lion 是64位的操作系统 所以以下所有软件 都选择64位的安装包!
1. 安装Python和Django:
1.1 Python
MAC中已经安装Python 你可以升级到最新的稳定版,我这次使用的是Python2.7
下载地址:http://www.php.cn/
1.2 Django(http://www.php.cn/)
Django的下载地址: http://www.php.cn/
解压后到文件所在目录,执行:
python setup.py install
安装 Django
django安装是否成功的测试也简单,进入python编辑环境,
输入:import django
然后输入:django.VERSION
如果能够正确显示版本号,则说明成功。
2. 安装eclipse
下载Eclipse 解压后运行Eclipse:
通过eclipse->Windows->Preferences->Install/Update->Available Software Sites增加Pydev网址,然后通过eclipse->help->Install New Software...进行安装PyDev
PyDev的eclipse下载地址:http://www.php.cn/
配置PyDev,Preferences->Pydev->Interpreter-Python点Auto Config创建Python工程: File->New->Other...->Pydev Project,
测试开发环境:src上右键new->Pydev Module->...Hello.py里输入 print('hello'),F9运行成功
然后打开Eclipse,选择Window -> Preferences -> Pydev- > Interpreter-Python,然后在右侧的“Python Interpreters”面板中选择New,
在弹出的对话框的“Interpreter Name”写Python,在“Interpreter Executable”中定位到python的地址,然后一直选择“ok”即可:
3.安装MySQL数据库:
Mysql:http://www.php.cn/
MysQLWorkbench: http://www.php.cn/
4. 安装Eclipse中开发Python的插件PyDev
5.安装python-mysqldb
下载MySQL-python-1.2.3.tar 下载地址:http://www.php.cn/
解压后进入到MySQL-python目录下修改文件site.cfg中的行
#mysql_config = mysql_config = /usr/local/bin/mysql_config
将注释去掉
修改为mysql_config = mysql_config = /usr/local/bin/mysql_config所在的路径
你可以尝试通过命令行执行
#python setup.py build
#python setup.py install
进行安装 !假如安装失败:
则通过xcode安装Command Line Tool 来安装Gcc 编译工具;
下载地址:http://www.php.cn/
安装完成后!在到MySQL-python目录下 执行:
#python setup.py build
#python setup.py install
假如顺利执行,没有报错的话!你可以执行python
然后导入MySQLdb尝试是否安装成功!
#python
>>>import MySQLdb
5.创建Django WebSite 工程连接数据库MySQL:
创建Django website:File->New->Other...->Pydev Django Project,Run as Django,然后打开http://www.php.cn/:8000/.
复制:http://www.php.cn/:8000/在浏览器中打开:
manage.py常用命令:
django-admin.py startproject mysite:新建项目。
manage.py runserver IP port:启动django自带服务器。
manage.py shell:启动django后台shell。
manage.py startapp appname:建立一个app。
manage.py validate:校验模型是否正确。
manage.py sqlall appname:生成create table语句。
manage.py syncdb:为模型生成相应表。
以上就是MAC (Mountain Lion)+Eclipse+python+Django+PyDve+MySQL 开发环境搭建的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA
