一、问题

1.1、环境
①、操作系统:Windows 10;
②、开发工具:

PyCharm 2021.1.3 (Community Edition) Build #PC-211.7628.24, built on
June 30, 2021 Runtime version: 11.0.11+9-b1341.60 amd64 VM: OpenJDK
64-Bit Server VM by JetBrains s.r.o. Windows 10 10.0 GC: G1 Young
Generation, G1 Old Generation Memory: 2034M Cores: 8 Non-Bundled
Plugins: Batch Scripts Support (1.0.12), CMD Support (1.0.5),
com.carbonblack.intellij.rpmspec (1.2.0),
com.intellij.plugins.eclipsekeymap (203.5981.152), com.jetbrains.nim
(1.4.0-203), com.jetbrains.plugins.ini4idea (211.6693.44),
com.leinardi.pycharm.mypy (0.11.2)

③、数据库环境:

Navicat for mysql 11.0.10 Mysql :8.0.18

④、Python 环境: 3.5.4;

1.2、问题

Traceback (most recent call last):
File “core\predict_amount.py”, line 10, in
File “d:\pythonproject\predict3.5.4\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 389, in load_module
exec(bytecode, module.dict)
File “lib\site-packages\statsmodels\api.py”, line 5, in
File “d:\pythonproject\predict3.5.4\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 389, in load_module
exec(bytecode, module.dict)
File “lib\site-packages\statsmodels\iolib_init_.py”, line 1, in
File “d:\pythonproject\predict3.5.4\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 389, in load_module
exec(bytecode, module.dict)
File “lib\site-packages\statsmodels\iolib\foreign.py”, line 14, in
File “d:\pythonproject\predict3.5.4\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 389, in load_module
exec(bytecode, module.dict)
File “lib\site-packages\statsmodels\compat_init_.py”, line 1, in
File “d:\pythonproject\predict3.5.4\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 389, in load_module
exec(bytecode, module.dict)
File “lib\site-packages\statsmodels\tools_init_.py”, line 1, in
File “d:\pythonproject\predict3.5.4\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 389, in load_module
exec(bytecode, module.dict)
File “lib\site-packages\statsmodels\tools\tools.py”, line 6, in
File “d:\pythonproject\predict3.5.4\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 389, in load_module
exec(bytecode, module.dict)
File “lib\site-packages\pandas_init_.py”, line 22, in
File “d:\pythonproject\predict3.5.4\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 389, in load_module
exec(bytecode, module.dict)
File “lib\site-packages\pandas\compat\numpy_init_.py”, line 25, in
ImportError: this version of pandas is incompatible with numpy < 1.13.3
your numpy version is 1.13.1.
Please upgrade numpy to >= 1.13.3 to use this pandas version
Failed to execute script predict_amount

二、解答

这里已经提示得很明显了,请把numpy库升级到1.13.3以上。在这里插入图片描述
执行命令

conda update numpy

或者

conda install numpy=1.20.3

结果如下:

(venv) D:\pythonProject\predict3.5.4\core>conda update numpy
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: D:\software\anaconda3_202105x86_64

  added / updated specs:
    - numpy


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    cfitsio-3.470              |       he774522_6         512 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    imagecodecs-2021.6.8       |   py38h5da4933_0         6.1 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tifffile-2021.7.2          |     pyhd3eb1b0_2         135 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    typed-ast-1.4.3            |   py38h2bbff1b_1         135 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    ------------------------------------------------------------
                                           Total:         6.9 MB

The following NEW packages will be INSTALLED:

  cfitsio            anaconda/pkgs/main/win-64::cfitsio-3.470-he774522_6

The following packages will be UPDATED:

  imagecodecs                      2021.3.31-py38h5da4933_0 --> 2021.6.8-py38h5da4933_0
  tifffile           pkgs/main::tifffile-2021.4.8-pyhd3eb1~ --> anaconda/pkgs/main::tifffile-2021.7.2-pyhd3eb1b0_2
  typed-ast                            1.4.2-py38h2bbff1b_1 --> 1.4.3-py38h2bbff1b_1


Proceed ([y]/n)? y


Downloading and Extracting Packages
cfitsio-3.470        | 512 KB    | ############################################################################################################################################################################################### | 100%
typed-ast-1.4.3      | 135 KB    | ############################################################################################################################################################################################### | 100%
imagecodecs-2021.6.8 | 6.1 MB    | ############################################################################################################################################################################################### | 100%
tifffile-2021.7.2    | 135 KB    | ############################################################################################################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: -
done

(venv) D:\pythonProject\predict3.5.4\core>pyinstaller -F  --hidden-import pandas --hidden-import="pandas._libs.tslibs.timedeltas" --hidden-import="pandas._libs.tslibs.np_datetime" --hidden-import="pandas._libs.tslibs.nattype"  --hidden
-import="pandas._libs.skiplist"  predict_amount.py
130 INFO: PyInstaller: 3.2.1
131 INFO: Python: 3.5.4
131 INFO: Platform: Windows-10-10.0.19041-SP0
133 INFO: wrote D:\pythonProject\predict3.5.4\core\predict_amount.spec
145 INFO: UPX is not available.
147 INFO: Extending PYTHONPATH with paths
['D:\\pythonProject\\predict3.5.4', 'D:\\pythonProject\\predict3.5.4\\core']
147 INFO: checking Analysis
803 INFO: checking PYZ
1042 INFO: checking PKG
1279 INFO: Building because D:\pythonProject\predict3.5.4\core\build\predict_amount\predict_amount.exe.manifest changed
1280 INFO: Building PKG (CArchive) out00-PKG.pkg
16313 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.
16387 INFO: Bootloader d:\pythonproject\predict3.5.4\venv\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
16387 INFO: checking EXE
16408 INFO: Building because manifest changed
16409 INFO: Building EXE from out00-EXE.toc
16409 INFO: Appending archive to EXE D:\pythonProject\predict3.5.4\core\dist\predict_amount.exe
16464 INFO: Building EXE from out00-EXE.toc completed successfully.

查看最新的numpy版本

conda list numpy

结果如下:
在这里插入图片描述

完毕~

三、总结

承接项目开发(电商,金融,直播,大数据算法,机器学习,深度学习等互联网开发项目),承接外包等互联网业务~

欢迎关注我的
CSDN博客: https://blog.csdn.net/River_Continent
微信公众号:幕桥社区
在这里插入图片描述
知乎:张牧野, https://www.zhihu.com/people/zhang-mu-ye-37-76/activities
简书: https://www.jianshu.com/u/02c0096cbfd3

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐