I have a python script I have always run from command line prompts that prints maps from MXD/ ArcGIS. It says the following error when trying to run it:
os.environm{PROJ_LIB] = pyproj.datadir.get_dta_dir()
NameError: name pyproj' is not defined
I understand this may be due to some change in my python environment based on other comments I can find. Can anyone help with next steps to remedy this? Below is how my script begins if that is helpful:
import arcpy, os, time, sys
arcpy.env.overwriteOutput = True
import arcpy, pyproj, os, time, sys
arcpy.env.overwriteOutput = True
Oops, sorry formatting got me. Try this.
pyproj 3.6.1 documentation (pyproj4.github.io)
you may have to install it with conda or pip if it isn't available for import
If your code relies on packages outside the default arcpy environment, it's good practice to import the pip module and either wrap their imports in a try except ImportError block and then run pip.main(["install", "<module>"]) or check the sys.modules environment variable for the module name and then pip.main...
arcpy tends to overwrite installed modules when it gets an update because the environment is pulled from ESRI