关于pyinstaller windows系统打包pathlib的报错

windows系统conda环境当用pyinstaller 打包的是往往会报这个错:    

SystemExit: The 'pathlib' package is an obsolete backport of a standard library package and is incompatible with PyInstaller. Please remove this package (located in d:\ProgramData\anaconda3\lib\site-packages) using     conda remove then try again.

看看 是让你移除pathlib,用conda remove,我看到一个博主也是conda remove pathlib,但是我劝大家不要,搞不好会把conda 环境搞坏掉。用pip uninstall  pathlib 既可以解决问题。

下面是一个简单实例供大家测试用:

import os
from PyInstaller.__main__ import run

if __name__ == '__main__':
    # 获取当前脚本所在目录
    script_dir = os.path.dirname(os.path.abspath('__main__'))
    
    params = [
        '--name=myapp',  # 打包后的程序名称
        '--onefile',  # 打包成单个可执行文件
        '--console',  # 控制台程序
        os.path.join(script_dir, 'pandas_join.py'),  # 要打包的Python文件路径
        '--hidden-import=pandas',
        '--hidden-import=numpy',

    ]
    
    run(params)

  • 19
    点赞
  • 42
    收藏
    觉得还不错? 一键收藏
  • 17
    评论
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值