V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
h19981126g
V2EX  ›  Python

新手初学 py 后用 pyinstaller 打包程序后运行 exe 出现问题

  •  
  •   h19981126g · 2018-03-17 21:36:48 +08:00 · 5883 次点击
    这是一个创建于 2231 天前的主题,其中的信息可能已经有所发展或是发生改变。
    用 python3.6 制作了个爬虫。在 pycham 里能正常运行,用了 requests,beautifulsoup,pandas,json,re,datetime 等第三方库
    但是 pyinstaller 打包完成没什么问题,运行 exe 程序就出现了错误:
    源码地址: https://gitee.com/rufengkj/zwu_educational_system/blob/master/sina%E6%96%B0%E6%B5%AA%E6%96%B0%E9%97%BB/Sina_News.py

    raceback (most recent call last ):
    File site-packages\pandas\ init. py, line 26, in <module)
    File c: users hugang \appdata\local \programs \python \ python36\lib\site-packages Py Installer(loader \py imod03 importers
    line 631. in exec module
    exec(bytecode, module. dict
    filesite-packages\pandas libs init. py, line 4, in <module>
    File"c: \users hugang appdata local \programs \python python 36\lib\site-packages\Py Installer\loader \pyimod03 importers
    line 714. in load module
    module= loader load module(fullname)
    File pandas libs\tslib pyx, line 1, in init pandas. libs tslib
    lodulenotfounderror: No module named pandas. libs. tslibs timedeltas
    During handling of the above exception, another exception occurred
    raceback (most recent call last)
    File Sina News. py, line 8, in <module)
    File c: users hugang \appdata local programs \python \python36lib\site-packages\ Py Installer(loader pyimod03 importers
    line 631, in exec module
    exec(bytecode, module. dict
    File site-packages \pandas init. py, line 35, in <module)
    mporterror: C extension: No module named pandas. libs. tslibs timedeltas “ not built. If you want to import pandas from
    he source directory, you may need to run python setup. py build ext --inplace--force “ to build the C extensions first
    5636 Failed to execute script Sina News

    OCR 识别的截图,略有缺省,见谅!
    4 条回复    2018-03-17 23:34:50 +08:00
    jackyzy823
        1
    jackyzy823  
       2018-03-17 22:15:35 +08:00
    Shawnone
        2
    Shawnone  
       2018-03-17 22:50:25 +08:00   ❤️ 1
    --hidden-import="pandas._libs.tslibs.timedeltas"
    h19981126g
        3
    h19981126g  
    OP
       2018-03-17 23:15:36 +08:00
    @Shawnone pyinstaller -F xxx.py --hidden-import="pandas._libs.tslibs.timedeltas"的确是,谢谢
    Les1ie
        4
    Les1ie  
       2018-03-17 23:34:50 +08:00
    之前我也遇到了,解决方案是在 python 目录里面手动加一个 pandas 的 hook
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1056 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:25 · PVG 06:25 · LAX 15:25 · JFK 18:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.