2024年8月18日星期日

使用conda安装paddleocr

 conda env  remove --name paddle_env


conda create --name paddle_env2 python=3.12 -c conda-forge


conda activate paddle_env2

#conda install -c conda-forge cudatoolkit=11.7 

#conda install  -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/   paddlepaddle-gpu==2.6.1

很奇怪,把下面的命令拆分成上面的2条命令,竟然安装失败

conda install  -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/   paddlepaddle-gpu==2.6.1 cudatoolkit=11.7 -c conda-forge



pip  install  --dry-run paddleocr


conda install  -c conda-forge Cython PyYAML beautifulsoup4 charset-normalizer colorama contourpy cycler fire fonttools imageio  kiwisolver lazy_loader lmdb  lxml matplotlib networkx packaging  pyclipper pyparsing python-dateutil python-docx  rapidfuzz requests  scikit-image scipy shapely six soupsieve termcolor  tifffile  tqdm urllib3


conda  install  -c conda-forge --dry-run  imgaug

下面3个程序,无法用conda安装

pip install --dry-run  --no-deps opencv-python

pip install --dry-run  --no-deps opencv-contrib-python 

pip install --dry-run  --no-deps imgaug

#paddleocr 会将numpy降级到2.0以下

pip install --dry-run  --no-deps paddleocr

numpy不降级,paddleocr不能用

paddleocr --image_dir .\img\zsbf.jpg

AttributeError: `np.sctypes` was removed in the NumPy 2.0 release. Access dtypes explicitly instead.. Did you mean: 'dtypes'?

2024年7月29日星期一

find命令

root@debian:/# find /   -path  /mnt/disk -prune  -type f  -name   2GSRM4Z7.zip

root@debian:/# find /   -path ./mnt/disk -prune  -type f  -name   2GSRM4Z7.zip

root@debian:/# find /                                         -type f   -name   2GSRM4Z7.zip

为什么只有第3个命令能找到文件?

how-to-use-prune-option-of-find-in-sh


find / -path /mnt/disk  -prune -o -name '2GSRM4Z7.zip' -print

上面的命令,能找到文件。

2024年7月26日星期五

windows安全

  1.  禁用smb  如何禁用smb
  2. 在组策略中,启用 fail2ban
  3. 使用复杂的密码
  4. 禁用远程登陆

2024年7月5日星期五

yt-dlp

 yt-dlp.exe     --proxy       "socks5://127.0.0.1:2080/"      url

2024年6月26日星期三

mikeio encoding error

 ---------------------------------------------------------------------------

UnicodeEncodeError                        Traceback (most recent call last)
Cell In[16], line 2
      1 for f  in file_lst:
----> 2     df = mikeio.read(f).to_dataframe()

File C:\py_venv\py_leafmap\Lib\site-packages\mikeio\__init__.py:133, in read(filename, items, time, keepdims, **kwargs)
    130 if "dfs" not in ext:
    131     raise ValueError("mikeio.read() is only supported for Dfs files")
--> 133 dfs = open(filename)
    135 return dfs.read(items=items, time=time, keepdims=keepdims, **kwargs)

File C:\py_venv\py_leafmap\Lib\site-packages\mikeio\__init__.py:186, in open(filename, **kwargs)
    180     raise Exception(
    181         f"{ext} is not a supported format for mikeio.open. Valid formats are {valid_formats}"
    182     )
    184 reader_klass = READERS[ext]
--> 186 return reader_klass(filename, **kwargs)

File C:\py_venv\py_leafmap\Lib\site-packages\mikeio\dfs\_dfs0.py:101, in Dfs0.__init__(self, filename)
     98 if not path.exists():
     99     raise FileNotFoundError(path)
--> 101 dfs = DfsFileFactory.DfsGenericOpen(str(path))
    102 self._source = dfs
    104 # Read items

File C:\py_venv\py_leafmap\Lib\site-packages\mikecore\DfsFileFactory.py:84, in DfsFileFactory.DfsGenericOpen(filename, parameters)
     81 @staticmethod
     82 def DfsGenericOpen(filename, parameters = None):
     83     dfs = DfsFile();
---> 84     dfs.Open(filename, DfsFileMode.Read, parameters);
     85     return dfs

File C:\py_venv\py_leafmap\Lib\site-packages\mikecore\DfsFile.py:726, in DfsFile.Open(self, filename, mode, parameters)
    724 # Marshal filename string to C char*
    725 fnp = ctypes.c_char_p()
--> 726 fnp.value = filename.encode("cp1252")
    728 if mode is DfsFileMode.Read:
    729     # Open file for reading
    730     rok = DfsDLL.Wrapper.dfsFileRead(
    731         fnp.value, ctypes.byref(self.headPointer), ctypes.byref(self.filePointer)
    732     )

File ~\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py:12, in Codec.encode(self, input, errors)
     11 def encode(self,input,errors='strict'):
---> 12     return codecs.charmap_encode(input,errors,encoding_table)

UnicodeEncodeError: 'charmap' codec can't encode character '\u5e74' in position 10: character maps to <undefined>
encoding with 'cp1252' codec failed

2024年6月22日星期六

chrome socks5 proxy from cmd

 https://www.chromium.org/developers/design-documents/network-stack/socks-proxy/

To configure chrome to proxy traffic through the SOCKS v5 proxy server myproxy:8080, launch chrome with these two command-line flags:


--proxy-server="socks5://myproxy:8080"


--host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE myproxy"


Explanation


The --proxy-server="socks5://myproxy:8080" flag tells Chrome to send all http:// and https:// URL requests through the SOCKS proxy server "myproxy:8080", using version 5 of the SOCKS protocol. The hostname for these URLs will be resolved by the proxy server, and not locally by Chrome.


NOTE: proxying of ftp:// URLs through a SOCKS proxy is not yet implemented.

The --proxy-server flag applies to URL loads only. There are other components of Chrome which may issue DNS resolves directly and hence bypass this proxy server. The most notable such component is the "DNS prefetcher".Hence if DNS prefetching is not disabled in Chrome then you will still see local DNS requests being issued by Chrome despite having specified a SOCKS v5 proxy server.


Disabling DNS prefetching would solve this problem, however it is a fragile solution since once needs to be aware of all the areas in Chrome which issue raw DNS requests. To address this, the next flag, --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE myproxy", is a catch-all to prevent Chrome from sending any DNS requests over the network. It says that all DNS resolves are to be simply mapped to the (invalid) address 0.0.0.0. The "EXCLUDE" clause make an exception for "myproxy", because otherwise Chrome would be unable to resolve the address of the SOCKS proxy server itself, and all requests would necessarily fail with PROXY_CONNECTION_FAILED.