背景
在 PyCharm 中基于 Anaconda 环境配置 PyInstaller,选中 .py 文件运行 pyInstaller.exe 对指定的 .py 文件进行打包,出现以下报错:
The 'typing' package is an obsolete backport of a standard library package and is incompatible with PyInstaller. Please `conda remove typing` then try again.
尝试
按提示在Anaconda Prompt base环境中运行conda remove typing,问题未解决。
(base) C:\Users\Administrator>conda remove typing
Collecting package metadata: done
Solving environment: /
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:
- defaults/win-64::flask==1.0.2=py36_1
- defaults/win-64::flask-cors==3.0.4=py36_0
- defaults/win-64::bokeh==0.12.16=py36_0
- defaults/win-64::bottleneck==1.2.1=py36hd119dfa_0
- defaults/win-64::datashape==0.5.4=py36h5770b85_0
- defaults/win-64::h5py==2.7.1=py36h3bdd7fb_2
- defaults/win-64::imageio==2.3.0=py36_0
- defaults/win-64::matplotlib==2.2.2=py36h153e9ff_1
- defaults/win-64::mkl_fft==1.0.1=py36h452e1ab_0
- defaults/win-64::mkl_random==1.0.1=py36h9258bd6_0
- defaults/win-64::numpy==1.14.3=py36h9fa60d3_1
- defaults/win-64::numba==0.38.0=py36h830ac7b_0
- defaults/win-64::numexpr==2.6.5=py36hcd2f87e_0
- defaults/win-64::pandas==0.23.0=py36h830ac7b_0
- defaults/win-64::pytest-arraydiff==0.2=py36_0
- defaults/win-64::pytest-doctestplus==0.1.3=py36_0
- defaults/win-64::pywavelets==0.5.2=py36hc649158_0
- defaults/win-64::scipy==1.1.0=py36h672f292_0
- defaults/win-64::bkcharts==0.2=py36h7e685f7_0
- defaults/win-64::dask==0.17.5=py36_0
- defaults/win-64::patsy==0.5.0=py36_0
- defaults/win-64::pytables==3.4.3=py36he6f6034_1
- defaults/win-64::pytest-astropy==0.3.0=py36_0
- defaults/win-64::scikit-learn==0.19.1=py36h53aea1b_0
- defaults/win-64::astropy==3.0.2=py36h452e1ab_1
- defaults/win-64::odo==0.5.1=py36h7560279_0
- defaults/win-64::scikit-image==0.13.1=py36hfa6e2cd_1
- defaults/win-64::statsmodels==0.9.0=py36h452e1ab_0
- defaults/win-64::blaze==0.11.3=py36h8a29ca5_0
- defaults/win-64::seaborn==0.8.1=py36h9b69545_0
/
解决方法
参考@海和森林42方法
请不要用:conda remove typing
正确的是:pip uninstall typing
修改命令为 pip uninstall typing
(base) C:\Users\Administrator>pip uninstall typing
Found existing installation: typing 3.6.4
Uninstalling typing-3.6.4:
Would remove:
g:\software\anaconda3\lib\site-packages\typing-3.6.4-py3.6.egg-info
g:\software\anaconda3\lib\site-packages\typing.py
Proceed (Y/n)? y
Successfully uninstalled typing-3.6.4
再次运行打包文件,问题解决!!!