python - 配置 Pycharm 以运行 Pyinstaller

标签 python python-3.x pycharm osx-yosemite pyinstaller

是的,我想在 PyCharm 中创建一个运行配置来运行 Pyinstaller 并获取我的可执行文件。根据Pyinstaller documentation安装后,您应该能够找到一个名为 pyinstaller-folder/pyinstaller.py 的 python 脚本,但它不在那里。然后我仔细查看,发现另一个名为 pyinstaller-folder/__main__.py 的文件应该是相同的 <--(我胡乱猜测),所以我设置了我的运行配置,如下所示:

enter image description here

运行后,出现这个错误:

/usr/local/Cellar/python3/3.4.3/bin/python3.4 /usr/local/lib/python3.4/sit

e-packages/PyInstaller/__main__.py --onefile --nowindow --osx-bundle-identifier=jg.optimizer -F --name=genoptimizer optimizer/manage.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/PyInstaller/__main__.py", line 26, in <module>
    from . import __version__
SystemError: Parent module '' not loaded, cannot perform relative import

Process finished with exit code 1

它似乎需要一个父模块才能运行,但是,那会是什么样子呢?

最佳答案

两年多后,或许还有更好的选择。

在 PyCharm 菜单中转到文件 -> 设置
在“设置”对话框中找到工具 -> 外部工具 并使用绿色 + 添加新的外部工具。

例如:

enter image description here

然后,IDE 将允许您在任何 python 脚本上运行它。右键单击该文件,上下文菜单将显示外部工具 -> PyInstaller

关于python - 配置 Pycharm 以运行 Pyinstaller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33906539/

相关文章:

python - 使用 python 3.5 用希伯来语和英语解析 json 文件

python - 在sqlalchemy中,什么对应于mysql函数 'load_file'?

python - 如何将 .txt 文件的内容分配给 Python 中的字符串变量?

linux - 在 IDE 或系统范围内安装框架?

python - 错误: Cannot install PyCharm: No JRE found

intellij-idea - 无法在 PyCharm 中将目录标记为测试源根目录

python - 如何过滤私有(private)用户与用户的交互?

python - QWebEngine.loadFinished.connect() 是做什么的?

python-3.x - python : how to create a smoothed version of a 2D binned "color map"?

python - 将长数字文字分成多行