Crypto, Cython, pyinstaller, gdal (windows) library installation, use Xshell to copy a large number of files

1. Crypto can be used to encrypt passwords to generate licenses, but it cannot be installed directly via pip. FAQ

from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto

Installation method:
Uninstall the installed Crypto library

pip uninstall Crypto
pip uninstall pycrypto

Correct installation command:

pip install pycryptodome

Crypto, pycrypto and pycrytodome are the same thing. The name of crypto in python is pycrypto. It is a third-party library and has been discontinued.
如果需要Crypto库的话,直接使用pip install pycryptodome这条命令就可以'
If it doesn't work, try other methods you see.

pip install crypto pycryptodome
pip uninstall crypto pycryptodome
pip install pycryptodome

2. Installation of gdal library. It is very troublesome to install in Windows system. It cannot be installed directly with pip. First go to the website to download the required gdal version: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
Insert image description here
and then Use command:

pip install GDAL-2.2.4-cp36-cp36m-win_amd64.whl

After it is installed, it can be called. The following reference containing osgeo will not report an error.

import osgeo
from osgeo import ogr, osr,gdal

3. Problem: ImportError: Module use of python38.dll conflicts with this version of Python. Solution

ImportError: Module use of python36.dll conflicts with this version of Python.

I can't remember exactly how it happened. It seems that when conda created the virtual environment, it gave the python=3.8 version for installation. Then when installing the library, the library installed in the environment was the python3.6 version, and python3 was automatically downloaded. .6, resulting in a conflict between the two versions.

解决办法:在装虚拟环境路径的文件夹下搜索找到python38.dll,把这个文件删除,或者剪切走,这样环境就会使用下载的python3.6版本,不会再报这个错'

4. Cython library installation, the cython library used for compilation. When I first see the error, I subconsciously
pip install Cython directly. In fact, this does not work. The correct method is:

pip install cython

5. Install the pyinstaller library. The pyinstaller library is usually used for packaging. Installation method:

pip install pyinstaller

6. When using cp, when using SSH server to copy a large number of pictures to a specified location, bash: /bin/cp: Argument list too long, prompting that the parameter list is too long. Solution: Use the find command:

find test/ -name "*.jpg" | xargs -i cp {
    
    } train
"""把test下的所有jpg文件拷贝到train文件夹下"""

or

find test/ -name "*.jpg" -exec cp {
    
    } train \;

other:

find test/ -name "*.jpg" | xargs -i rm {
    
    }
find test/ -name "*.jpg" -exec rm {
    
    } \;

7. When using Xshell to manage remote servers, especially when using vi to edit configuration files, I am always accustomed to using ctrl+s to save files, and then it becomes a tragedy.
There is no response from xsell and I can only close it and reopen it. But the original modified file is considered scrapped. After searching on the Internet, it turns out that the shortcut key of Xshell's ctrl+s is the function of locking the screen. If you want to unlock it, press ctrl+q to resume screen scrolling.

8. Array operations:

Insert image description here
9. python reads file content separated by spaces:

filename = 'xxxx.txt'
    with open(filename,'r') as f:
        lines = f.readlines()
        for line in lines:      
            x=line.split()[1]
            y=line.split()[2]
            x1=line.split()[3]
            y1=line.split()[4]

Guess you like

Origin blog.csdn.net/qq_44442727/article/details/129614687