简体   繁体   中英

How to set up PyInstaller in PyCharm for a project using External Tools inside venv?

I have a project in PyCharm with multiple Python files, as well as some text files, which I want to export into .exe via PyInstaller (I'm on Win 7). The project uses some external modules installed inside venv via pip (PyInstaller is one of them).

外部工具设置

I want to keep things simple and not use any modules outside venv in the build, for obvious reasons. However, when I try to execute the PyInstaller tool on the project folder, I get a permission error: PermissionError: [Errno 13] Permission denied . Using PyInstaller on the main.py inside the project builds it just fine at first glance, but running the .exe in cmd shows an error loading Python DLL . How do I do it right? Something tells me the spec should be created beforehand to include all files and modules used in the project.

To answer the question in the title, the Arguments you specify in PyCharm are passed to pyinstaller.exe when you execute the tool. So it should be the path to main.py or the path to your .spec file, not $FilePath$ which is a macro that gets replaced by the file that is currently open in PyCharm.

You should definitely have a .spec file, that is committed to version control. This makes your PyInstaller builds more consistent, and allows others to reproduce them easily. See https://pyinstaller.readthedocs.io/en/stable/spec-files.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM