Tag Archives: The road of Python cultivation

Python Error: mongod: error while loading shared libraries: libcrypto.so.1.1

Reading guide

After installing mongodb in Python, the following error is reported when executing mongod

mongod: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory

Solution:

Find the virtual environment used. For example, the name of my virtual environment is torch , and use the following command to check whether the libcrypto. So. 1.1 file exists in the environment

#Switch to the lib directory
cd /root/anaconda3/envs/torch/lib
# Check if the file exists
ls -lh | grep "libcrypto.so.1.1"
-rwxrwxrwx 1 root root 3.2M Jun 4 15:43 libcrypto.so.1.1
# If the file exists execute the following command
sudo ldconfig /root/anaconda3/envs/torch/lib

If there is no in the Lib directory, use the following command for global search

find/-name 'libcrypto.so.1.1'

Observe the search results and find the existing directory by using the above sudo ldconfig directory path

[Solved] redis.exceptions.ResponseError: unknown command `KEYS`

Error message

When querying redis using python, all key information will be reported as errors

redis.exceptions.ResponseError: unknown command `KEYS`, with args beginning with: `*`, 

The code is as follows

import redis

pool = redis.ConnectionPool(host='127.0,0.1', port=6379, db=0, password='123456')
r = redis.StrictRedis(connection_pool=pool_16_6)
print(r.keys())

Solution:

for key in r.scan_iter("*"):
     print(key)