安装教程
1. 下载
官网下载地址
2. 选择3.5(根据自身系统选择)版本下载
3. 下载完成,直接双击运行,即可,安装路径可选。
(注意:在双击运行后,打开安装程序界面,建议选择“增加环境变量”)
4. 环境变量设置
如果步骤3已经勾选了“增加环境变量”的话,就不用再设置环境变量。如果没有勾选,环境变量设置方法如下:
找到自己的Python3.5的安装路径(例如我的是:D:\Python 3.5),把以下几个路径添加到系统环境变量中。
①计算机--邮件--属性,打开如下界面:
②点击“高级系统设置”,再点击“环境变量”,如下:
![](https://img-blog.csdnimg.cn/2019111314592795.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L05vYW1hTmVsc29u,size_16,color_FFFFFF,t_70)
![](https://img-blog.csdnimg.cn/20191113145935475.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L05vYW1hTmVsc29u,size_16,color_FFFFFF,t_70)
③在系统变量中找到path,双击打开path,然后再路径的最末尾加入:
Python的路径,要以“;”隔开,即可:
D:\Python35; D:\Python35\Lib; D:\Python35\Scripts;
![](https://img-blog.csdnimg.cn/20191113145959922.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L05vYW1hTmVsc29u,size_16,color_FFFFFF,t_70)
④验证Python是否安装成功,开始---输入“cmd”,回车打开命令行,输入:Python,看到如下界面就表示Python安装成功。
以上安装python3.5的时候,默认已经安装了pip工具,这里直接升级pip到最新即可。
python -m install --upgrade pip
pip install pyqt5
pip install pyqt5-tools
D:\Python 3.5\Lib\site-packages\pyqt5_tools\Qt\bin\designer.exe,(换成自己的目录即可)
②arguments:
$FileDir$\$FileName$
③working directory:
$FileDir$
① program:
D:\Python 3.5\Scripts\pyuic5.exe(换成自己的目录即可)
②arguments:
$FileName$ -o $FileNameWithoutExtension$.py
③working directory:
$FileDir$
① program:
D:\Python 3.5\Scripts\pyrcc5.exe(换成自己的目录即可)
②arguments:
$FileName$ -o $FileNameWithoutExtension$.py
③working directory:
$FileDir$
pip3 install pyinstaller
在Pycharm主界面,点击“工具-外部工具”,就可以看到自己添加的几个外部工具了
# -*- coding: utf-8 -*-
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
self.textEdit.setGeometry(QtCore.QRect(180, 50, 441, 411))
self.textEdit.setObjectName("textEdit")
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 23))
self.menubar.setObjectName("menubar")
self.menutes = QtWidgets.QMenu(self.menubar)
self.menutes.setObjectName("menutes")
MainWindow.setMenuBar(self.menubar)
self.menubar.addAction(self.menutes.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.textEdit.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> _ooOoo_ </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> o8888888o </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> 88 . 88 </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> (| -_- |) </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> O\\\\ = /O </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> ____/`---\'\\\\____ </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> . \' \\\\| |// `. </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> / \\\\||| : |||// \\\\ </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> / _||||| -:- |||||- \\\\ </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> | | \\\\\\\\\\\\ - /// | | </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> | \\\\_| \'\'\\\\---/\'\' | | </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> \\\\ .-\\\\__ `-` ___/-. / </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> ___`. .\' /--.--\\\\ `. . __ </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> ."" \'< `.___\\\\_<|>_/___.\' >\'"". </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> | | : `- \\\\`.;`\\\\ _ /`;.`/ - ` : | | </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> \\\\ \\\\ `-. \\\\_ __\\\\ /__ _/ .-` / / </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> ======`-.____`-.___\\\\_____/___.-`____.-\'====== </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> `=---=\' ")</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> ............................................. </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> 佛祖镇楼 BUG辟易</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> 佛曰: </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> 写字楼里写字间,写字间里程序员;</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> 程序人员写程序,又拿程序换酒钱。 </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> 酒醒只在网上坐,酒醉还来网下眠;</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> 酒醉酒醒日复日,网上网下年复年。</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> 但愿老死电脑间,不愿鞠躬老板前; </p></body></html>"))
self.menutes.setTitle(_translate("MainWindow", "Testing"))
import sys
import untitled
from PyQt5 import QtWidgets
#from PyQt5.QtWidgets import QApplication,QMainWindow
from untitled import Ui_MainWindow
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = untitled.Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())