Python deep learning solves error reporting problems encountered 8

This article continuesPython deep learning to solve error reporting problems encountered 7-CSDN Blog

Table of contents

1. OSError: [WinError 127] The specified program cannot be found. Error loading "D:\my_ruanjian\conda-myenvs\deeplearning\lib\site-packages\torch\lib\caffe2_detectron_ops.dll" or one of its dependencies.

二、proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation

三、 There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1002)'))) - skipping

四、Max retries exceeded with url: /pkgs/main/linux-64/current_repodata.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1002)')))

五、ImportError: cannot import name 'clock' from 'time' (unknown location)

六、UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x00000200EDD9BEA0>


1. OSError: [WinError 127] The specified program cannot be found. Error loading "D:\my_ruanjian\conda-myenvs\deeplearning\lib\site-packages\torch\lib\caffe2_detectron_ops.dll" or one of its dependencies.

Error reported:

Reason: It is caused by the mismatch between the versions of torch and torchaudio

Solution:

二、proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation

Scenario: A problem was discovered recently. When developing usingGDAL+Python, the code always reports the following error:

Reason: It can be seen from the error that GDAL encountered a version conflict when calling PROJ.

  1. The bottom layer of GDAL uses the PROJ library to perform coordinate system-related conversions;
  2. The PostgreSQL database plug-in PostGIS also uses PROJ;

The PROJ library versions installed by the two tools are different and interfere with each other in the computer environment variables.

Solution: Find the installation address corresponding to your own python package,

import os
# 对应自己的python包的安装地址
os.environ['PROJ_LIB'] = r'D:\my\python-pycharm\python-envs\pathplanning\Lib\site-packages\pyproj\proj_dir\share\proj'

Then when I run the code, no error is reported.

三、 There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1002)'))) - skipping

Error: An error is reported when using pip install a certain package

Cause analysis: Unable to access https://pypi.tuna.tsinghua.edu.cn/simple/pip, SSL certificate authentication problem.

Solution: At this time, you need to obtain ssl certificate certification. You need to add: -i http:// after the original installation command. mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com (you can also change to other sources), this isAli source - -trusted-host mirrors.aliyun.com This is to obtain the authentication of the ssl certificate.

四、Max retries exceeded with url: /pkgs/main/linux-64/current_repodata.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1002)')))

Error: After I set up the domestic source, I used conda to create a virtual environment, and the following error occurred when downloading the python version.

Cause analysis: Judging from the error message, the resource cannot be obtainedhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/current_repodata.json, and then try to obtain the resource through the wget command

Solution: Enterconda config --set ssl_verify false in the command line to modify the settings, or add a line at the end of the file~/.condarc ( If necessary, just modify it), change the https in the Tsinghua source links to http. ssl_verify: false

五、ImportError: cannot import name 'clock' from 'time' (unknown location)

Error reported:

Reason: This problem usually occurs after Python 3.8, because in Python 3.8, the clock() function in the time module is abandoned and replaced by the perf_counter() function and process_time() function.

Solution: Then, the way to solve this problem is to use the perf_counter() function or process_time() function instead of the clock() function. These two functions are used for performance counting and process timing respectively, which can measure time more accurately.

from time import process_time as timer

timer()

 

六、UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x00000200EDD9BEA0>

Error reported:

Reason: This link is a picture, but python cannot read the picture and reports an error. There may be a problem with the picture that prevents it from being read.

https://images.mulberry.com/i/mulberrygroup/RL5792_000N651_L/small-hampstead-deep-amber-small-classic-grain-ayers/small-hampstead-deep-amber-small-classic-grain-ayers?v=3&w=304

Solution: Report the image error locally and change the filepath path to the local path

img = Image.open('../images/pack.jpg')

Guess you like

Origin blog.csdn.net/qq_45956730/article/details/133895757