Pycharm怎么打包python脚本打包成exe

Pycharm怎么打包Python脚本?
求助,目的是想将Python脚本放到其它WindowsPC上运行,该PC不需要安装解释器,目前能想到的办法就是打包成exe,但不会用。而我现在用的工具是Pycharm,所以请教下,怎么使用Pycharm将Python进行打包
python2时代是py2exe,python3已是cxFreeze。且PyQT5和OpenGL不是py2exe的菜,曾经为了pyqt4和opengl改用了pyinstaller,凭使用经验cxFreeze又方便又快,多数情况下不用自己写打包脚本,一行python C:\Python33\Scripts\ youpyfile.py 就exe完成了。撇开Pycharm,命令行即可。
python3是必须的,pyqt是做界面的,pycharm是优秀的IDE,pyinstaller生成可执行文件,。1.先按照教程安装python3,QT,pycharm软件,因为目前PyQt5只支持python3.4,所以安装python3.4。参考教程在环境变量中增加:QT_QPA_PLATFORM_PLUGIN_PATHC:\Python34\Lib\site-packages\PyQt5\plugins
2.按照教程创建界面,创建窗口时选“Widget”,然后按照说明创建调用的主程序,就可以运行了。3.dos命令行输入:py -m pip install pyinstaller,安装pyinstaller。4.在要制作的exe文件目录输入pyinstaller -F -w *.py,就可以制作出exe。生成的文件放在同目录dist下。-F(注意大写)是所有库文件打包成一个exe,-w是不出黑色控制台窗口。不加-F参数生成一堆文件,但运行快。压缩后比单个exe文件还小一点点。加-F参数生成一个exe文件,运行起来慢。按照第一步的方法,将pyinstaller加入pycharm的external tool,我加了两个,一个生成单独exe文件,一个生成运行带库的程序目录。好了,环境搞好了,做界面,编程,调试,生成exe,慢慢练习吧!烟台的爬虾正肥,非常美味!
建议用pyinstaller,假设你的python代码是生成一个有GUI的程序yourpycode.py,那么只需要把pyinstaller和你的code放一起,在该目录运行python pyinstaller-2.0\pyinstaller.py -w yourpycoe.py即可完成打包。
py2exe可以帮你
已有帐号?
无法登录?
社交帐号登录浠巔ycharm鎺у埗鍙拌繍琛岀殑妯″潡-python,鎺у埗鍙癱onsole,pycharm-CodeGo.net
浠巔ycharm鎺у埗鍙拌繍琛岀殑妯″潡
鎴戞槸鏂版潵鐨刾ython鍜宲ycharm锛屾垜鎯充粠pycharm鎺у埗鍙扮殑鏂瑰紡锛屼綘鍙互浠嶪DLE杩愯涓涓ā鍧楋紝濡傛灉鍙兘鐨勮瘽銆
鎴戜滑鐨勬兂娉曟槸鍒涘缓绠鍗曠殑鍑芥暟鍜屼娇鐢ㄦ帶鍒跺彴娴嬭瘯浠栦滑鐨勨滄椿鈥濄
......浣犳庝箞鍋氾紝鍦╬ycharm锛
鏈枃鍦板潃 锛欳odeGo.net/584489/
-------------------------------------------------------------------------------------------------------------------------
1. 杩愯python pycharm鏄潪甯哥畝鍗曠殑锛屼粠鏂囨。寮曠敤锛
鍦ㄤ竴涓复鏃剁殑杩愯/璋冭瘯閰嶇疆杩愯涓涓剼鏈墦寮
鎵闇鐨勮剼鏈紪杈戝櫒涓紝鎴栧湪Project宸ュ叿绐楀彛涓夋嫨瀹冦
涓婃垨鎸塁trl +Shift +F10閫夋嫨杩愯銆傛墍浠
杩欐牱锛屼竴涓复鏃剁殑杩愯/璋冭瘯閰嶇疆涓婄殑鍗虫椂鍒涘缓銆
姝ゅ锛岃繕鏈変竴涓淧ython鐨勬帶鍒跺彴鈥濇彁渚沺ycharm锛氱湅
涓嬮潰鏄竴涓緥瀛愩
鍋囪浣犳湁涓涓悕涓篜ython妯″潡test_module.py锛
def a(*args, **kwargs):
print "I'm function a"
def b(*args, **kwargs):
print "I'm function b"
鐒跺悗锛屽湪pycharm鐨勨淧ython鎺у埗鍙扳濅綘鍙互杩欐牱鍋氾細
&&& from test_module import *
I'm function a
I'm function b
甯屾湜鏈夋墍甯姪銆
鏈枃鏍囬 锛氫粠pycharm鎺у埗鍙拌繍琛岀殑妯″潡
鏈枃鍦板潃 锛欳odeGo.net/584489/
Copyright 漏 2014 CodeGo.netGet Smart Assistance
PyCharm knows everything about your code. Rely on it for intelligent code completion, on-the-fly error checking and quick-fixes, easy project navigation, and much more.
Boost Code Quality
Write neat and maintainable code while the IDE helps you keep quality under control with PEP8 checks, testing assistance, smart refactorings, and a host of inspections.
Simply All You Need
PyCharm is designed by programmers, for programmers, to provide all the tools you need for productive Python development.
Intelligent Python Assistance
PyCharm provides smart code completion, code inspections, on-the-fly error highlighting and quick-fixes, along with automated code refactorings and rich navigation capabilities.
Web Development Frameworks
PyCharm offers great framework-specific support for modern web development frameworks such as Django, Flask, Google App Engine, Pyramid, and web2py.
Scientific Tools
PyCharm integrates with IPython Notebook, has an interactive Python console, and supports Anaconda as well as multiple scientific packages including matplotlib and NumPy.
Cross-technology Development
In addition to Python, PyCharm supports JavaScript, CoffeeScript, TypeScript, Cython, SQL, HTML/CSS, template languages, AngularJS, Node.js, and more.
Remote Development Capabilities
Run, debug, test, and deploy applications on remote hosts or virtual machines, with remote interpreters, an integrated ssh terminal, and Docker and Vagrant integration.
Built-in Developer Tools
A huge collection of tools out of the box: an integrated debu P a built- and integration with major VCS and built-in Database Tools.
Intelligent Python editor
Graphical debugger and test runner
Navigation and Refactorings
Code inspections
VCS support
Scientific tools
Web development
Python web frameworks
Python Profiler
Remote development capabilities
Database & SQL support
PyCharm Educational Edition
Have you ever wanted to learn programming with Python? Or maybe you’re using Python to teach programming?
Then we have the perfect tool for you.
What's New in PyCharm 2016.2
vmprof Profiler Support
For those who care about performance, PyCharm provides profiling support. Additionally to the previously supported cProfile and Yappi profilers, PyCharm 2016.2 brings support for vmprof, the sampling (statistical) Python profiler written in C and developed by members of the PyPy team.
Pandas Dataframes Viewer
PyCharm has had a special array viewer for NumPy arrays for a couple of years. PyCharm 2016.2 brings Pandas Dataframes support – a must-have feature for scientific developers and data scientists. Thanks to our user Yuli Fiterman for contributing this feature!
Thread Suspend Option
Previously, when the PyCharm debugger reached a breakpoint during execution, only the corresponding thread was suspended while others kept running. Now there is a Suspend option with two values: All and Thread. ‘All’ makes all threads stop at once, while ‘Thread’ stops the corresponding thread.
Customer Experience
Companies worldwide
use PyCharm.
Join our customers!
Full-fledged Professional
or Free Community

我要回帖

更多关于 python脚本打包apk 的文章

 

随机推荐