python错误

1、安装包的时候提示python -m pip install --upgrade pip

运行后无法升级
删除D:\tools\Python\Python37\Lib\site-packages路径下pip-10.0.1.dist-info
再次执行即可。

2、pip._vendor.urllib3.exceptions.ReadTimeoutError

超时错误,网络问题,多试几次,不行就下载whl
https://www.lfd.uci.edu/~gohlke/pythonlibs/

pip install Pillow-5.1.1-cp37-cp37m-win_amd64.whl

手动安装

3、 error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”:

方法2可以,也可以下载Microsoft Visual C++ 14.0
https://964279924.ctfile.com/fs/1445568-239446865

https://pan.baidu.com/s/1q2Nj41Xk85CHHv7_zOhQIA 密码:qbba
如果出现了.Net framework版本过低,小于4.5的最低版本要求:
[如果没出现这个问题,跳过这一步]
重新安装 .Net framework 更高的版本:
https://support.microsoft.com/en-us/help/3151800/the-net-framework-4-6-2-offline-installer-for-windows

再安装Microsoft visual c++ 14.0,

启动电脑,再安装

4、pip install cartopy错误

    C:\Users\jss\AppData\Local\Temp\pycharm-packaging\cartopy\setup.py:107: UserWarning: Unable to determine GEOS version. Ensure you have 3.3.3 or later installed, or installation may fail.
      '.'.join(str(v) for v in GEOS_MIN_VERSION), ))
    Proj 4.9.0 must be installed.

proj4的版本过低,使用的anaconda

conda install cartopy

或者手动下载whl

pip install Cartopy-0.18.0-cp37-cp37m-win_amd64.whl

5、Python报错xxx.whl is not a supported wheel on this platform

ERROR: Cartopy-0.18.0-cp38-cp38-win_amd64.whl is not a supported wheel on this platform

出现这个错误的原因是Python本地的版本与下载的安装包的版本不匹配。
文件中的cp38是指安装包支持的是Python3.8版本。

6、fiona安装错误

  A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.

先安装GDAL,手动下载whl,然后安装Fiona

7、pip install basemap 安装

首先安装pip install geos (python的basemap这个库是建立在geos中的)
下载pyproj和basemap两个包whl
pip先后安装pyproj和basemap,basemap已废弃现在用cartopy

8、wrf安装

Required Dependencies
Python 2.7, 3.4, or 3.5+
numpy (1.11 or later; 1.14 required to build on Windows)
wrapt (1.10 or later)
setuptools (38.0 or later)
conda install -c conda-forge wrf-python

9、pygrib安装问题

xarray代替,使用cfgrib
根据欧洲中心官方文档的描述,GRIB数据文件的编解码将使用ecCodes来替换之前的GRIB-API

conda install -c conda-forge cfgrib

10、ECCODES_DEFINITION_PATH错误

Possible causes:
- The software is not correctly installed
- The environment variable ECCODES_DEFINITION_PATH is defined but incorrect

ecCodes assertion failed: `0' in C:\bld\eccodes_1555087073004\work\src\grib_context.c:205

windows的bug
方法1、

os.environ['ECCODES_DEFINITION_PATH']='E:\ProgramData\Miniconda3\envs\py37\Library\share\eccodes\definitions'

方法2、
PyCharm->Run->Edit Configurations->环境变量参数加入

11、Metview安装

https://confluence.ecmwf.int/display/METV/Releases

conda install -c conda-forge metview

12、httplib2安装失败

conda失败使用pip试试

# conda install httplib2 #失败 
pip install httplib2

13、python3用matplotlib绘图出现中文乱码的问题

Font family ['sans-serif'] not found. Falling back to DejaVu Sans.

1、查看字体路径

import matplotlib    
print(matplotlib.matplotlib_fname())

2、下载simhei.ttf ,放到指定目录下

/opt/conda/envs/grib/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf

3、使用命令 rm -rf ~/.cache/matplotlib/ 删除缓存
4、重新执行绘图即可

14、Pycharm中Python报错:ImportError: DLL load failed: 找不到指定的模块

conda activate py37
python manage.py run test #执行无错误

点击pycharm中Terminal

D:\chongqing\chq-grid-decode>
# 正确应该如下
(py37) D:\chongqing\chq-grid-decode>

numpy和numpy-base 都是1.81.1版本
解决如下:
File->Settings删除所有Project Interpreter,重新引用

15、win安装了opencv-python,却无法import cv2

检查是否安装VS2015 C++及以上版本
参考:https://stackoverflow.com/questions/55360459/no-module-named-cv2-cv2
使用depends软件查看究竟缺失什么DLL(成功)
下载地址:http://www.dependencywalker.com/
下载后打开opencv安装目录,找到cv2.cp37-win_amd64.pyd
我的是缺少MF.dll、MFPLAT.dll、MFREADWRITE.dll、python37.dll
前3个是C:/Windows/System32下面的,最后一个是xx/Miniconda3下

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值