Tag Archives: windows

Linux accesses the shared directory of windows, pysmb (parameter remote)_Name (defined)

Scheme I

net use this command is only available under windows.

Scheme II

sudo mount -t cifs -o username=administrator,password=password //remote_ share_ server_ ip/share_ Dir./data
this command must use root permission. It cannot be implemented for applications that cannot use root permission. If there is no sudo, an error will be reported:
mount: only root can use "-- options" option

Programme III

Python package pysmb

def check_unc_source(self, unc_path, username, password):
    conn = SMBConnection(username, password, '', remote_name, is_direct_tcp=True)
    result = conn.connect('remote_share_server_ip', 445)
    with open("local_file", "wb") as local_file:
        conn.retrieveFile("share_dir", "file", local_file)

The 4th parameter of SMBConnection, remote_name:

The NetBIOS machine name of the remote server.
On windows, you can find out the machine name by right-clicking on the “My Computer” and selecting “Properties”.
This parameter must be the same as what has been configured on the remote server, or else the connection will be rejected.

You can actually fill in the IP address of the server where the Windows remote shared directory is located, i.e. the same as the first parameter remote_share_server_ip of conn.connect, if it is empty, an error will be reported:
smb.smb_structs.OperationFailure: Failed to retrieve [file] on share_dir: Unable to connect to shared device

Solve the problem that WSL occupies too much C disk

It can be installed to other disks

Download Ubuntu installation package

Manually download Windows Subsystem for Linux (WSL) Distros | Microsoft Docs

Change the suffix (zip) and unzip it to another disk.

Open Ubuntu *. Exe and install it

Something went wrong


Error 0x800701bc WSL 2 ??????????????????


Error 0x80370102

The first problem is that the windows service required by WSL is not enabled


Start the corresponding service in settings

The following services need to be enabled: 1. Hyper-V     2. Virtual machine platform       3. Windows subsystem for Linux

PS: windows11 setting steps,   Application – & gt; Optional function (pull to the bottom) – & gt; More windows services

The second problem is that the required files are not installed when wsl1 is upgraded to wsl2


Download the installation package and install it.

https://wslstorestorage.blob.core.windows.net/wslblob/wsl_ update_ x64.msi

When installing in other paths, the boot subsystem is the root user. If you don’t want to start WSL, the default is the root user. You can follow the steps below.

1. Add a new user,

sudo add username

2. Grant permission (nothing can be done without permission)

sudo usermod -a -G adm username

sudo usermod -a -G sudo username

3. Default user configuration for Ubuntu

.\ubuntu2004.exe config --default-user username

If the author enters PowerShell under the installation directory, the absolute path can be used for configuration without entering the installation directory.

pyvista error: root:GLEW could Missing GL version settlement method

Project scenario:

Windows10 + python3.6 + pyvista0.31.3

Problem Description:

Problem Description: after upgrading the windows system, a strange error suddenly appeared in the well run code about pyvista visualization ply file some time ago:

ERROR:root:GLEW could not be initialized: Missing GL version

Cause analysis:

After upgrading windows, some things have been added to the environment variable path, resulting in the environment variable being too long, exceeding the maximum length of 1023 characters, and the following environment variables have been truncated.


Find a way to shorten the path of the environment variable, delete some paths that are not used very much, or use RapidEE environment variable editing tool to optimize

[Solved] Kafka Error: Discovered coordinator XXXXX:9092 (id: 2147483647 rack: null) for group itstyle.

Error information:

Discovered coordinator DESKTOP-NRTTBDM:9092 (id: 2147483647 rack: null) for group itstyle.


The host of Kafka running on windows is the machine name, not the IP address

So it will lead to error reporting

Desktop-nrttbdm is the host name of the server where the Kafka instance is located
and 9092 is the port of Kafka, that is, the connection address of Kafka.


Modify the hosts file directly

The windows hosts file is located in


Open it with administrator’s permission and append the corresponding relationship between IP and host name


Restart the service again

Problem solved!

To solve the problem that windows Remote Desktop Services cannot copy and paste: restart rdpclip.exe

After connecting to the remote server, even if you select the “clipboard” function in the “local resources” tab, you still can’t copy and paste. The solution is found through Baidu, because the rdpclip.exe on the remote server doesn’t work properly. The solution is to open the task manager on the remote server, find the rdpclip.exe process, and close it.

Then enter rdpclip.exe in the start menu search box, press enter, and it will run again.

In windows, “cmake” is not an internal or external command, nor a runnable program or batch file.

1、 Problem description.

An error is reported when cmake is performed under Windows: ‘cmake’ is not an internal or external command, nor is it a runnable program or batch file.

2、 Problem analysis.

Lack of tool cmake.

3、 Solutions.

Install cmake. website: https://cmake.org/download/

When installing cmake, choose to add environment variables.


Error c3861: “strcasecmp”: identifier not found

1、 Problem description.

The C/C + + program compiles normally in Linux, and an error is reported in Windows: error c3861: “strcasecmp”:   Identifier not found.

2、 Problem analysis.

There is no library function related to strcasecmp in windows.

3、 Solutions.

Declare the library function of strcasecmp under windows.

#ifdef _WIN32
	//#define strcasecmp _stricmp
	//#define strncasecmp _strnicmp
#ifdef _MSC_VER
	#define strcasecmp _stricmp
	#define strncasecmp _strnicmp


Asp.netcore project publishing and deploying to IIS needs aspnetcore module v2

PS: the. Net framework can be directly published and can be accessed normally when specified by IIS. However, the aspnetcore project is slightly different. An additional module needs to be installed. If it is not installed, an HTTP error of 500.19 – internal server error will be reported.

1. Official version address: https://dotnet.microsoft.com/download/dotnet

Find the version 3.1 or 5.0 and click to enter.

2. Page   IIS runtime support (asp.net core module V2), that is, IIS running support needs modules. In the windows column, click download.

3. For aspnetcore 3.1, Download dotnet-hosting-3.1.15-win.exe and install it. Then you can see aspnetcore module V2 in the module of IIS

jemter java.net.BindException:Address alreardy in use [How to Solve]



Windows itself provides port access mechanism.

Windows provides TCP/IP link ports of 1024 ~ 5000, and it takes 4 minutes to recycle these ports. At this time, if we run a large number of requests in a short time, the ports will be full.


win + r   Enter regedit to open the registry   Find the following path

Computer_ LOCAL_ MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Right click parameters to create a new DWORD   The name is maxuserport   The value is 65534 (maximum 65535, set 65534 to prevent all ports from being occupied)

Right click parameters to create a new DWORD   The name is   TCPTimedWaitDelay   Value is 30 (default unit is seconds)

Reference: HTTPS://support.microsoft.com/zh-cn/help/196271/when-you-try-to-connect-from-tcp-ports-greater-than-5000-you-recover-t

Making Python script into exe command under Windows

Making Python script into exe command under Windows

Method 1: use windows batch processing (Windows command script)

    create a new fanyi.bat file, which is as follows.

    @echo off
    python3 D:\test\fanyi.py %1
      add the current folder to the environment variable, re open a CMD window, and enter the command Fanyi Hello

      The second method uses pyintaller module to generate EXE file

        install pyinstaller module

        pip install pyinstaller
          enter the D: [test directory, and execute the generate command

          pyinstaller fanyi.py

          Generated fanyi.exe The file is in the D::

            add the folder to the environment variable and execute the command in CMD

MySQL driver compiling method of QT under windows and solutions to abnormal errors


Recently, in the process of compiling QT’s MySQL driver with MinGW under windows, it was compiled through several twists and turns. In the process of compiling, there are many problems. In order to avoid similar errors in the subsequent driver compilation and facilitate the rapid completion of this driver compilation, the compilation methods are sorted out.

This method is illustrated by a case of my own compiling environment.

1、 Compiling environment

Operating system: win7 64 bit

MySQL service version: mysql-5.5.46-win32

QT version: 4.8.6

Compiling environment: MinGW 64 bit

2、 Compilation steps

(1) Generate libmysql. A file

Because MinGW compiler needs to use “. A” suffix static library file to connect with static library, but according to MySQL database, there is only “. Lib” format static library, so it needs to be converted. Two tools are needed for conversion reimp.exe and dlltool.exe The paths of these two tools need to be configured in the path environment variable. The conversion command is as follows:

First of all, open the CMD command input box and enter the Lib path under the MySQL installation path. For example, my path is: “C:// program files (x86)  MySQL  MySQL server 5.5  lib”.

Next, enter the following commands in turn:

reimp -d  libmysql.lib

dlltool -k -d  libmysql.def  -l libmysql.a

After successful execution, you can view the library file of libmysql. A in this path.

(2) Editor mysql.pro Engineering documents

Find it in the installation path of QT mysql.pro The path of my pro file is: “C:// Qt/4.8.6/SRC/plugins/sqldrivers/MySQL”.

open mysql.pro File, add the following configuration below:

INCLUDEPATH+=”C:/ProgramFiles(x86)/MySQL/MySQL Server 5.5/include/”

LIBS+= -L”C:/ProgramFiles(x86)/MySQL/MySQL Server 5.5/lib/” –llibmysql

The second line can also be written as follows:

LIBS+= “C:/ProgramFiles(x86)/MySQL/MySQL Server 5.5/lib/libmysql.a”

Makefile Makefile.Debug 、 Makefile.Release Three makefile files and others. As shown in the figure below:

(3) Edit makefile file

Take the debug version as an example. open Makefile.Debug File, find LIBS = “XXXX” line and modify it. Because there is a problem with this configuration generated.

The original configuration is as follows:

LIBS = -L”c:\Qt\4.8.6\lib”debug\qsqlmysqld_ resource_ res.o -llibmysql “-LC:/ProgramFiles(x86)/MySQL/MySQL Server 5.5/lib/” -llibmysql -lQtSqld4 -lQtCored4

According to our intention, according to makefile’s syntax rules, we can clearly find the problem. First of all, “L” must be placed outside the path of the configuration library. Second, the – llibmysql command has repetition.

It is revised as follows:

LIBS = -L”c:\Qt\4.8.6\lib”debug\qsqlmysqld_ resource_ res.o -L “C:/Program Files(x86)/MySQL/MySQLServer 5.5/lib/” -llibmysql -lQtSqld4 -lQtCored4

Or it can be modified as follows:

LIBS = -L”c:\Qt\4.8.6\lib”debug\qsqlmysqld_ resource_ res.o “C:/Program Files(x86)/MySQL/MySQL Server5.5/lib/libmysql.a” -lQtSqld4 -lQtCored4

The release version of makefile is modified in the same way.

(4) Execute the make command

Use the mingw32 make command to execute makefile. If no parameter is added, it will be executed by default Makefile.Debug . You can write debug or release or both after mingw32 make command to execute the corresponding version of makefile.

For example, execute debug and release makefile at the same time. The command is as follows:

mingw32-make debug release

After successful execution, you can see qsqlmysqld. A qsqlmysqld.dll Two library files, in the release folder, see qsqlmysql. A qsqlmysql.dll Two library files.

These four library files are the static library and dynamic library driven by MySQL of debug and release versions.

(5) Copy the driver file to the specified directory

Copy the four driver files generated in the previous step to the database driver directory of QT, that is, under the path of “C:: (QT) ﹣ 4.8.6 ﹣ plugins ﹣ sqldrivers”.

(6) Copy libmysql.dll File to specified directory

Install the libmysql.dll Copy the dynamic library file to the bin directory of QT, i.e. “C:// Qt/4.8.6/plugins/sqldrivers”. At this point, use QT to write a program to connect to MySQL database.

3、 Test whether the driver is available

Write demo program to test QT driver. The main codes are as follows:

#include <QtCore/QCoreApplication>  

#include <QDebug>  

#include <QStringList>  

#include <QString>  

#include <QSqlDatabase>  

int main(int argc, char *argv[])  


    QCoreApplication a(argc, argv);  

    qDebug()<<“Available drivers:”;  

    QStringList drivers = QSqlDatabase::drivers();  

    foreach(QString driver,drivers)  


    return a.exec();  


Add in project file

QT       +=sql

Running this demo program, you can see “qmysql3” and “qmmysql” in the list of available drivers. As shown in the figure below:

4、 Common problems and Solutions

(1) Cannot find – llibmysql

“- llibmysql” cannot be found because the configuration in makefile is incorrect. After modifying Makefile, compile it again, and the compilation passes.

The solution to this problem is: check the configuration in Makefile, modify it to conform to the rules of makefile syntax, and then try again.

(2) Undefined reference to ‘MySQL’_ character_ set_ [email protected]

This situation, as well as a series of undefined references related to MySQL, is due to a problem loading the MySQL library. After online query of relevant information, we know that it is the version problem of MySQL database. When using the link library in 64 bit MySQL database, we will report this error.

The solution is to install a 32-bit MySQL database and configure it mysql.pro File, compile the driver again, and the error will not appear again.

(3) Unrecognized command line option \ “- fno keep inline dllexport \”

The reason for this error is that the version of the compiler is relatively low. To query the version of the currently used gcc compiler is GCC – 4.4.0. The explanation of the online information is as follows:

this is because\”-fno-keep-inline-dllexport\” is the option of mingw 4.6.1, but i’musing 4.5. So I change it by installingcodelite-3.5.5377-mingw4.6.1-wx2.9.2.exe

The translation is as follows:

This is because the option “- fno keep inline dllexport” is a function of mingw4.6.1. The current version is too low, so the gcc compiler of version 4.6.1 or above is needed.

Later, the MinGW compiler environment of 4.8.1 version of gcc compiler was installed. When compiling this driver, the above error disappeared.

Therefore, the solution to this problem is to install the gcc compiler above 4.6.1.