Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 指向可执行文件的点py_Python_Pip_Pycharm_Pyinstaller - Fatal编程技术网

Python 指向可执行文件的点py

Python 指向可执行文件的点py,python,pip,pycharm,pyinstaller,Python,Pip,Pycharm,Pyinstaller,我真的不知道还要做什么才能在.exe中编译我的项目。 尝试了很多教程,包括我在这里和github上找到的一个,但都没有成功 我使用pycharm社区版2021.1 我的指令: Microsoft Windows [versão 10.0.19042.985] (c) Microsoft Corporation. Todos os direitos reservados. C:\WINDOWS\system32>python -m pip install pyinstaller Requi

我真的不知道还要做什么才能在.exe中编译我的项目。 尝试了很多教程,包括我在这里和github上找到的一个,但都没有成功

我使用pycharm社区版2021.1

我的指令:

Microsoft Windows [versão 10.0.19042.985]
(c) Microsoft Corporation. Todos os direitos reservados.

C:\WINDOWS\system32>python -m pip install pyinstaller
Requirement already satisfied: pyinstaller in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (4.3)
Requirement already satisfied: pefile>=2017.8.1 in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (2021.5.24)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (2021.1)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: altgraph in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (0.17)
Requirement already satisfied: setuptools in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (56.0.0)
Requirement already satisfied: future in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)

C:\WINDOWS\system32>
我的powershell:

PS C:\WINDOWS\system32> python -m pip install pyinstaller                                                               Requirement already satisfied: pyinstaller in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (4.3)
Requirement already satisfied: pefile>=2017.8.1 in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (2021.5.24)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (2021.1)
Requirement already satisfied: altgraph in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (0.17)
Requirement already satisfied: setuptools in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (56.0.0)
Requirement already satisfied: future in c:\users\anton\appdata\local\programs\python\python39\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)
PS C:\WINDOWS\system32>
我的pycharm终端:

(c) Microsoft Corporation. Todos os direitos reservados.

(venv) C:\Users\anton\PycharmProjects\Curso>\pyinstaller -w -F bobeiruda.py
'\pyinstaller' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
english: (pyinstaler is not recognized as an internal or external command, an operable program or a file in lots)

(venv) C:\Users\anton\PycharmProjects\Curso>python --version
Python 3.9.5

(venv) C:\Users\anton\PycharmProjects\Curso>pip --version
pip 21.1.2 from c:\users\anton\pycharmprojects\curso\venv\lib\site-packages\pip (python 3.9)

(venv) C:\Users\anton\PycharmProjects\Curso>pyinstaller --version
4.3

(venv) C:\Users\anton\PycharmProjects\Curso>

pycharm pt2

(venv) C:\Users\anton\PycharmProjects\Curso>pyinstaller bobeiruda.py --onefile
100 INFO: PyInstaller: 4.3
100 INFO: Python: 3.9.5
116 INFO: Platform: Windows-10-10.0.19042-SP0
118 INFO: wrote C:\Users\anton\PycharmProjects\Curso\bobeiruda.spec
147 INFO: UPX is not available.
167 INFO: Extending PYTHONPATH with paths
['C:\\Users\\anton\\PycharmProjects\\Curso',
 'C:\\Users\\anton\\PycharmProjects\\Curso']
pygame 2.0.1 (SDL 2.0.14, Python 3.9.5)
Hello from the pygame community. https://www.pygame.org/contribute.html
3302 INFO: checking Analysis
3503 INFO: checking PYZ
3641 INFO: checking PKG
3641 INFO: Building PKG because PKG-00.toc is non existent
3641 INFO: Building PKG (CArchive) PKG-00.pkg
4297 WARNING: Can not get binary dependencies for file: C:\Users\anton\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python
.exe
4298 WARNING:   Reason: 'The file is empty'
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\anton\PycharmProjects\Curso\venv\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "c:\users\anton\pycharmprojects\curso\venv\lib\site-packages\PyInstaller\__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\anton\pycharmprojects\curso\venv\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\anton\pycharmprojects\curso\venv\lib\site-packages\PyInstaller\building\build_main.py", line 737, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\users\anton\pycharmprojects\curso\venv\lib\site-packages\PyInstaller\building\build_main.py", line 684, in build
    exec(code, spec_namespace)
  File "C:\Users\anton\PycharmProjects\Curso\bobeiruda.spec", line 21, in <module>
    exe = EXE(pyz,
  File "c:\users\anton\pycharmprojects\curso\venv\lib\site-packages\PyInstaller\building\api.py", line 438, in __init__
    self.pkg = PKG(self.toc, cdict=kwargs.get('cdict', None),
  File "c:\users\anton\pycharmprojects\curso\venv\lib\site-packages\PyInstaller\building\api.py", line 200, in __init__
    self.__postinit__()
  File "c:\users\anton\pycharmprojects\curso\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
    self.assemble()
  File "c:\users\anton\pycharmprojects\curso\venv\lib\site-packages\PyInstaller\building\api.py", line 279, in assemble
    pylib_name = os.path.basename(bindepend.get_python_library_path())
  File "c:\users\anton\pycharmprojects\curso\venv\lib\site-packages\PyInstaller\depend\bindepend.py", line 956, in get_python_library_path
    raise IOError(msg)
OSError: Python library not found: libpython39.dll, libpython3.9m.dll, libpython39m.dll, libpython3.9.dll, python39.dll
    This would mean your Python installation doesn't come with proper library files.
    This usually happens by missing development package, or unsuitable build parameters of Python installation.

    * On Debian/Ubuntu, you would need to install Python development packages
      * apt-get install python3-dev
      * apt-get install python-dev
    * If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)


(venv) C:\Users\anton\PycharmProjects\Curso>

(venv)C:\Users\anton\PycharmProjects\Curso>pyinstaller bobeiruda.py--onefile
100信息:PyInstaller:4.3
100信息:Python:3.9.5
116信息:平台:Windows-10-10.0.19042-SP0
118信息:编写了C:\Users\anton\PycharmProjects\Curso\bobeiruda.spec
147信息:UPX不可用。
167信息:使用路径扩展PYTHONPATH
['C:\\Users\\anton\\PycharmProjects\\Curso',
'C:\\Users\\anton\\PycharmProjects\\Curso']
PyGame2.0.1(SDL2.0.14,Python 3.9.5)
大家好,来自pygame社区。https://www.pygame.org/contribute.html
3302信息:检查分析
3503信息:正在检查PYZ
3641信息:检查包装
3641信息:正在生成PKG,因为PKG-00.toc不存在
3641信息:建筑包装(CArchive)包装-00.PKG
4297警告:无法获取文件C:\Users\anton\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\Python的二进制依赖项
.exe
4298警告:原因:“文件为空”
回溯(最近一次呼叫最后一次):
文件“C:\Program Files\WindowsApps\PythonSoftwareRefoundation.Python.3.9\u 3.9.1520.0\u x64\u qbz5n2kfra8p0\lib\runpy.py”,第197行,作为主运行模块
返回运行代码(代码、主全局、无、,
文件“C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9.1520.0\u x64\uuuuuqbz5n2kfra8p0\lib\runpy.py”,运行代码第87行
exec(代码、运行\全局)
文件“C:\Users\anton\PycharmProjects\Curso\venv\Scripts\pyinstaller.exe\ \uuuuu main\uuuuuuu.py”,第7行,在
文件“c:\users\anton\pycharmprojects\curso\venv\lib\site packages\PyInstaller\\uuuuuu main\uuuuuuu.py”,第114行,正在运行
运行构建(pyi\u配置,规范文件,**vars(args))
文件“c:\users\anton\pycharmprojects\curso\venv\lib\site packages\PyInstaller\ \uuuuuu main\uuuuuuuuu.py”,第65行,在运行版本中
PyInstaller.building.build\u main.main(pyi\u配置,spec\u文件,**kwargs)
文件“c:\users\anton\pycharmprojects\curso\venv\lib\site packages\PyInstaller\building\build\u main.py”,第737行,在main中
构建(specfile,kw.get('distpath'),kw.get('workpath'),kw.get('clean_build'))
文件“c:\users\anton\pycharmprojects\curso\venv\lib\site packages\PyInstaller\building\build\u main.py”,第684行,内部版本
exec(代码、规范和命名空间)
文件“C:\Users\anton\PycharmProjects\Curso\bobeiruda.spec”,第21行,在
exe=exe(pyz,
文件“c:\users\anton\pycharmprojects\curso\venv\lib\site packages\PyInstaller\building\api.py”,第438行,在u init中__
self.pkg=pkg(self.toc,cdict=kwargs.get('cdict',无),
文件“c:\users\anton\pycharmprojects\curso\venv\lib\site packages\PyInstaller\building\api.py”,第200行,在\uu init中__
self.\uuuu postinit\uuuuu()
文件“c:\users\anton\pycharmprojects\curso\venv\lib\site packages\PyInstaller\building\datastruct.py”,第160行,在__
self.assembly()
汇编中第279行的文件“c:\users\anton\pycharmprojects\curso\venv\lib\site packages\PyInstaller\building\api.py”
pylib_name=os.path.basename(bindepend.get_python_library_path())
文件“c:\users\anton\pycharmprojects\curso\venv\lib\site packages\PyInstaller\depend\bindepend.py”,第956行,位于get\u python\u library\u路径中
引发IOError(msg)
OS错误:未找到Python库:libpython39.dll、libpython3.9m.dll、libpython39m.dll、libpython3.9.dll、python39.dll
这意味着您的Python安装没有附带正确的库文件。
这通常是由于缺少开发包,或者Python安装的构建参数不合适造成的。
*在Debian/Ubuntu上,您需要安装Python开发包
*apt-get-install-python3-dev
*apt-get-install-python-dev
*如果您自己构建Python,请使用“--enable shared”(或达尔文上的“--enable framework”)重新构建Python
(venv)C:\Users\anton\PycharmProjects\Curso>
我遵循了教程,没有任何更改,仍然无法编译我的文件:

这只是一堆截图,不是问题-请将您有问题的代码作为文本发布,并清楚地表达您的问题。似乎您想使用PyInstaller从Python脚本创建一个可执行文件-具体问题是什么?基本上我和这家伙有相同的问题,但我做了所有事情,仍然无法创建一个.exe,我从官方网站重新安装了python,在powershell、cmd和pycharm终端上尝试了pip命令,但什么都没有。我收到的代码错误与帖子中的错误相同。