日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)Python教程:別人怎么用我的Python程序

別人怎么用我的python程序

這里講的給別人用,不是指將你的代碼開(kāi)源,也不是指給另一個(gè)程序員用。比如你寫(xiě)了一個(gè)小工具,想給別人用,總不能叫別人也去裝python吧。

讓別人不裝Python環(huán)境就可以使用Python編寫(xiě)的程序,可以將Python程序打包.exe可執(zhí)行程序,然后發(fā)給他人。

推薦學(xué)習(xí)《Python教程》。

Python打包生成.exe文件的工具有:

1、py2exe

使用:

先寫(xiě)一個(gè)簡(jiǎn)單的腳本,文件名:helloworld.py

#!/usr/bin/env python  # -*- coding: utf-8 -*-  
  def say_hello(name):  
    print("Hello, " + name)
  if __name__ == "__main__":  
    name = input("What's your name:")
    say_hello(name)

還需要個(gè)用于發(fā)布程序的設(shè)置腳本:mysetup.py,在其中的 setup 函數(shù)前插入語(yǔ)句 import py2exe。

from distutils.core import setupimport py2exe
setup(console=["helloworld.py"])

2、cx_Freeze

使用:cxfreeze main.py --target-dir dist

Usage: cxfreeze [options] [SCRIPT]

Freeze a Python script and all of its referenced modules to a base
executable which can then be distributed without requiring a Python
installation.

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -O                    optimize generated bytecode as per PYTHONOPTIMIZE; use
                        -OO in order to remove doc strings
  -c, --compress        compress byte code in zip files
  -s, --silent          suppress all output except warnings and errors
  --base-name=NAME      file on which to base the target file; if the name of
                        the file is not an absolute file name, the
                        subdirectory bases (rooted in the directory in which
                        the freezer is found) will be searched for a file
                        matching the name
  --init-script=NAME    script which will be executed upon startup; if the
                        name of the file is not an absolute file name, the
                        subdirectory initscripts (rooted in the directory in
                        which the cx_Freeze package is found) will be searched
                        for a file matching the name
……
……
……

3、PyInstaller

使用:pyinstaller demo.py


網(wǎng)頁(yè)名稱:創(chuàng)新互聯(lián)Python教程:別人怎么用我的Python程序
網(wǎng)址分享:http://m.5511xx.com/article/dhocgpo.html