Python tk-auto-study Project notice error : No module named xxx

0, about

I introduced the GitHub project for automatic group lessons before.

Use the GitHub project to automatically do group lessons
https://blog.tsinbei.com/archives/83/

But some time ago, I installed other versions of Python 2, frying Yum and Firewalld directly, and broke the Python 3 environment by the way: PIP was installed, but it took it, but put it, but put it, but take it, but take it, but take it, but take it, but take it, but take it, but take it, but take it, but take it, but take it, but take it, but take it, but take it, but take it, but take it, but take it, but take it.

/usr/bin/

The soft link /usr/bin/pip3 is deleted, causing the final reinstallation of Python, YUM, Firewalld.

Originally thought that this was resumed, and the huge pit was dug, which was what I wanted to say below.

1. Reapped problem

Refer to the error information refer to GitHub Issue:

https://github.com/838239178/tk-Auto-study/ 63

python
Traceback (Most Recent Call Last):
File "main.py", line 18, in

Encryptor = ImportLib.import_module (f "crypt_module. {crypt_name}. {crypt_name} _ {crypt_mode}")

File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module

Return_bootstrap._gcd_import (name [level:], package, level)

File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlock
File "", LINE 665, in _Load_unLocked
File "", line 678, in exec_module
File "", LINE 219, in _Call_with_frames_removed
File "/.../crypt_module/sm4/sm4_ecb.py", line 1, in

From gmsl.sm4 import cryptsm4, sm4_encrypt, sm4_decrypt

ModulenotFounderror: no module named 'gmsl'

It can be seen that this is a very common problem: there is no module, usually as long as it is installed with PIP or yum.

2, error investigation

2.1. Check dependence

Try to use

bash
cd /.../
python3 main.py

Start the program directly.

After testing, the starting program directly in the command line does not report the above errors, and it can run normally, indicating that the dependencies have been installed. By checking the directory, it is indeed installed and there is no problem.

However, if you copy the same command to the Bt plan task , an error will be reported.

2.2, path problem

Try to use

bash
cd /.../
/usr/bin/python3 /.../main.py

Even use the absolute path to start the program.

Through the test, there will be no problems in the command line, but the problem is still existing in the Bt plan task .

2.3, environment variable

Import environment variable

/root/.bashrc

That is to add at the end

bash
export pythonpath =/.../

implement

bash
source ~/.bashrc

Make it effective.

The problem still exists.

3. Solution

After investigation, the default Python 3 version is Python 3.9, and the environment variables also use Python 3.9, but there is no soft link /usr/bin/python3.9!

Can't be executed under the soft link to /usr/bin/ because I am

/root/.bashrc

Added:
[Hide]
bash
export path =/.../python3/bin/

[/hide]
In other words, the programs in this directory can be executed with relative paths.

The solution is to delete it, or execute
[Hide]
bash
ln - S /.../python3.9 /usr/bin/python3.9

[/hide]

4. Verification results

Test again, you can see the successful execution.

5. Summary

One said, I don't like the latest update of the GitHub project.

Adding an agency IP pool, it takes a long time to open it. Usually you need to try it dozens of times to have an IP available.

The reason for using the proxy IP is because the official website of the Fujian Communist Youth League ** blocks foreign IPs. It may be that a large number of users use the Github Actions of the project to check in.

It is for this reason that I migrated the service from GitHub Action to the server. The server can be opened normally in mainland China, which is very fast.

If so, I am afraid I will migrate the service back to Github Actions.

Python tk-auto-study Project notice error : No module named xxx

https://blog.tsinbei.com/en/archives/302/

Author
Hsukqi Lee
Posted on

2022-04-10

Edited on

2022-07-28

Licensed under

CC BY-NC-ND 4.0

Comments

Name
Mail
Site
None yet