Background:
today we use package to install the module dnspython
[root@makel ~] wget http://www.dnspython.org/kits/1.9.4/dnspython-1.9.4.tar.gz
[root@makel ~] tar -xvf dnspython-1.9.4.tar.gz
[root@makel ~] cd dnspython-1.9.4/
[root@makel dnspython-1.9.4] python3 setup.py install
Solution process
1. Enter Python and import reports an error (problem found)
[root@makel ~] python3
Python 3.8.5 (default, Nov 7 2021, 21:47:38)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dns.resolver
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/python3/lib/python3.8/site-packages/dns/resolver.py", line 26, in <module>
import dns.message
File "/usr/local/python3/lib/python3.8/site-packages/dns/message.py", line 175
return '<DNS message, ID ' + `self.id` + '>'
^
SyntaxError: invalid syntax
2. Try upgrading (– upgrade) and find that it still can’t be installed
[root@makel ~] pip3 install dnspython --upgrade
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: dnspython in /usr/local/python3/lib/python3.8/site-packages (1.9.4)
Collecting dnspython
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f5/2d/ae9e172b4e5e72fa4b3cfc2517f38b602cc9ba31355f9669c502b4e9c458/dnspython-2.1.0-py3-none-any.whl (241 kB)
|████████████████████████████████| 241 kB 898 kB/s
Installing collected packages: dnspython
Attempting uninstall: dnspython
Found existing installation: dnspython 1.9.4
ERROR: Cannot uninstall 'dnspython'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
3. A new error occurred while attempting to uninstall
[root@makel ~] pip3 uninstall dnspython
Found existing installation: dnspython 1.9.4
ERROR: Cannot uninstall 'dnspython'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
4. If the command cannot be unloaded, delete the file manually
[root@makel ~] cd /usr/local/python3 #Go to the directory where python is installed
[root@makel python3] find ./-name "*package*" #Fuzzy search package
./lib/python3.8/site-packages
./lib/python3.8/site-packages/setuptools/package_index.py
./lib/python3.8/site-packages/setuptools/__pycache__/package_index.cpython-38.pyc
./lib/python3.8/site-packages/setuptools/__pycache__/package_index.cpython-38.opt-1.pyc
......
[root@makel python3] cd lib/python3.8/site-packages/ #Find site-packages from the above results and go to this directory
[root@makel site-packages] ll
total 96
drwxr-xr-x. 4 root root 4096 Nov 16 17:18 dns
-rw-r--r--. 1 root root 1277 Nov 9 22:31 dnspython-1.9.4-py3.8.egg-info
....
[root@makel site-packages] rm -rf dnspython-1.9.4-py3.8.egg-info #Delete all files containing the module name
5. Reinstall and import successfully after installation
[root@makel site-packages] pip3 install dnspython #reinstall
[root@makel site-packages] python3
Python 3.8.5 (default, Nov 7 2021, 21:47:38)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dns.resolver
>>> exit
Read More:
- MYSQL 5.7 Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it..
- Python calls the MySQLdb library, and an error “Library not loaded: libmysqlclient.18.dylib” is reported
- pymysql Error: File “/usr/local/lib/python2.7/site-packages/PyMySQL-1.0.2-py2.7.egg/pymysql/connections.py”, line 167 SyntaxError: invalid syntax
- [Solved] Running in 64 bit mode with the 32 bit Oracle client installed
- Linux Error: [ERROR] –initialize specified but the data directory has files in it. Aborting.
- [Solved] ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full comm
- [Solved] dbeaver import Error: Error 1840 (HY000) at line 24
- [Solved] sqoop Import Datas to mysql error: ERROR tool.ExportTool: Error during export: Export job failed
- Zabbix import MySQL database error ERROR 1046 (3D000) at line 1: No database selected
- ERROR 1075 (42000) Incorrect table definition; there can be only one auto column and it must be defi
- Error running ‘Application‘: Command line is too long [How to Solve]
- nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression [Solved]
- Dbeaver Import SQL File Error: Error executing process Process failed (exit code = 1). See error log. Process failed (exit code = 1). See error log.
- How to Solve Error: mysqlclient 1.4.0 or newer is required; you have 0.10.0
- [Solved] EOS7.6 Error: Init DB failed [Specified key was too long; max key length is 767 bytes…
- [Solved] Windows MYSQL Error: django.db.utils.OperationalError: (2026, ‘SSL connection error: unknown error number‘)
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- [Solved] MYSQL 5.7 gruop by eRROR: this is incompatible with sql_mode=only_full_group_by
- [Solved] Error response from daemon: Conflict. The container name “/mysql is already in use by container