Python Cartopy library + error problem solving

Install Cartopy with Conda

Installation code:

conda install -c conda-forge cartopy

During the installation process, I encountered this problem: python cannot locate the program input point in the dynamic link library pythoncom37
insert image description here
After consulting the information on the Internet

  • The first reason: The environment you are using has not updated the conda
    code as follows:
conda update -n base conda		# 基环境

conda update -n [你的环境名称] conda # 其他虚拟环境

After the change, it was found to be incorrect, and this problem still occurs

  • The second reason: pythoncom37.dll duplicate
    pythoncom37.dll originally appeared in E:\Anaconda3\envs\O3\Library\bin\this folder,
    but it E:\Anaconda3\envs\O3\Lib\site-packages\pywin32_system32\also exists in this folder
    Solution : delete E:\Anaconda3\envs\O3\Lib\site-packages\pywin32_system32\this folder, pythoncom37.dll
    insert image description here
    reinstall, and Cartopytest, the code is as follows:
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines()

# Save the plot by calling plt.savefig() BEFORE plt.show()
plt.savefig('coastlines.pdf')
plt.savefig('coastlines.png')

plt.show()

I found that I still can't run Cartopy
the problem successfully : I updated cartopyTypeError: wrapper() got an unexpected keyword argument
in ANACONDA NAVIGATOR, re-run the code, and got the result!
insert image description here

insert image description here

Guess you like

Origin blog.csdn.net/weixin_45913084/article/details/129371369
Recommended