[Python] What to do when No module named'pyproj.datadir' appears when Exe is done with PyInstaller

background

When I started the Python file from the command prompt etc., it worked without problems. However, when I execute the Exe file with PyInstaller, pyproj is imported. The following error was sent and the program crashed.

ModuleNotFoundError: No module named 'pyproj.datadir'

environment

approach

Adding the path to pyproj to the data in Analysis () in the spec file worked fine.

.spec


a = Analysis(['hoge.py'],
             pathex=['C:\\workspace\\hoge\\src'],
             binaries=[],
             datas=[
                    ('C:\\Users\\grin\\Anaconda3\\envs\\py_37\\Lib\\site-packages\\pyproj\\*', '.\\pyproj\\'),
                    ],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)

Reference URL

Recommended Posts

[Python] What to do when No module named'pyproj.datadir' appears when Exe is done with PyInstaller
What to do when ModuleNotFoundError: No module named'XXX' occurs in Python
What to do when [Errno 2] No such file or directory appears in Python
What to do with PYTHON release?
What to do when "SSL: CERTIFICATE_VERIFY_FAILED _ssl.c: 1056" appears in Python
ImportError: No module What to do when you are told
What to do when there is no response due to Proxy setting in Python web scraping
What to do if Insecure Platform Warning appears when running Python
Python script written in PyTorch is converted to exe with PyInstaller
What to do when the value type is ambiguous in Python?
Suddenly with Python PyInstaller No module named pyinstaller
What to do when pyinstaller: error: argument --add-binary: invalid add_data_or_binary value: appears
What to do if No Python documentation found for ... appears in pydoc
[Python] What to do when an error related to SSL authentication is returned
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
What to do if "amazon-linux-extras" → "No module named amazon_linux_extras"
How to write what to do when an application is first displayed in Qt for Python with Designer
What to do if CERTIFICATE_VERIFY_FAILED occurs when nltk.download () is done on macOS pyhon
What to do when a warning appears around Python integration in Neovim's CheckHealth
What to do if you get an error when installing python with pyenv
[Go 1.13] What to do when unexpected directory layout: appears
[openpyxl] What to do when IllegalCharacterError appears in pandas.DataFrame.to_excel
curl: (60) What to do when Issuer certificate is invalid.
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
PyInstaller memorandum Convert Python [.py] to [.exe] with 2 lines
What to do when "cannot import name xxx" [Python]
pipenv shell is no longer available ... what to do?
What to do when you can't bind CaboCha to Python
[Python] Type Error:'WebElement' object is not iterable What to do when an error occurs
What to do if you get an OpenSSL error when installing Python 2 with pyenv
[Introduction to Python] What is the important "if __name__ =='__main__':" when dealing with modules?
[AWS] What to do when you want to pip with Lambda
What to do when Japanese is not displayed on matplotlib
What to do when PyCharm font is strange or garbled
What to do when an error occurs with import _ssl
OSError: [Errno 40] What to do when Message too long appears
What to do when "Invalid HTTP_HOST header" appears in Django
[Python Kivy] How to create an exe file with pyinstaller
What to do if you get Swagger-codegen in python and Import Error: No module named
How to log with python (when No handlers could be found for logger "__main__" appears)
What to do when no display name occurs when unittesting Python + Tkinter on Github Actions Memo
What to do if you install openCV3 and make a symbolic link, but when you do "import cv2", "No module named'cv2'" appears
[Python] What is a with statement?
What to do when Ubuntu crashes
What to do if you can't install pyaudio with pip #Python
[virtualbox] What to do when [Could not retrieve mirrorlist] appears when yum update is performed on CentOS7
When it is troublesome to copy what you built with vue
[Beanstalk] What to do when an error occurs with import uuid
To do tail recursion with Python2
What to do when a part of the background image becomes transparent when the transparent image is combined with Pillow
How to utilize Python with Jw_cad (Part 1 What is external transformation)
NameError: global name'dot_parser' is not defined and what to do when it comes up in python
Python | What you can do with Python
What to do if you get a "Wrong Python Platform" warning when using Python with the NetBeans IDE
[Mac OS] What to do when Python is not installed as a framework. Is displayed when import matplotlib is performed.
[Python] What to do when PEP8 is violated in the process of importing from the directory added to sys.path
What to do if PyInstaller3.5 gives an error in Python3.8 (TypeError: an integer is required (got type bytes))
What to do when "OS Error: [WinError 126] The specified module cannot be found" appears in import torch
What skills do I need to program with the FBX SDK Python?
[Memorandum] What to do when a warning appears after executing pip list