foreword
After configuring the linux server environment, run the python script and find that the smtplib module reports an error, but not on windows, the error is as follows:
linux module 'smtplib' has no attribute 'SMTP_SSL'
configure
- Centos7
- Python3.7
reason
Find the source code of smtplib.SMTP_SSL and find that the SMTP_SSL class is only established when have_ssl is True, and the have_ssl variable requires ssl dependency to be True, then the problem is found, there is no ssl dependency on linux
solution
- Install ssl dependencies
yum install openssl openssl-devel
- Verify that the installation was successful, check the version
openssl version -a
- Enter your python3.7 directory, for example, my python-3.7.6.tgz file is decompressed and placed in the /usr/tgz/python/Python-3.7.6 directory, enter the Modules folder under the file, some versions is the Module file
cd /usr/tgz/python/Python-3.7.6
cd Modules
- Modify the Setup file, the changes are as follows, and uncomment the 5 lines of code at more than 200 lines
vim Setup
Press ESC, :wq, Enter and save and exit
- Return to the previous directory, that is, the python3.7 directory, and reinstall python
cd ..
make && make install
- Run the code, problem solved
Read More:
- [Modified] AttributeError: ‘socket‘ object has no attribute ‘ioctl‘ python linux
- [Solved] LeNet Script Train Error: AttributeError: ‘DictIterator’ object has no attribute ‘get_next’
- Python 3 urllib has no URLEncode attribute
- [Solved] Python 3.6 Error: ‘dict’ object has no attribute ‘has_key’
- How to Solve Python AttributeError: ‘module’ object has no attribute ‘xxx’
- Python 3.7 Error: AttributeError: ‘str‘ object has no attribute ‘decode‘ [How to Solve]
- [Solved] Python Selenium Error: AttributeError: ‘WebDriver‘ object has no attribute ‘find_element_by_xpath‘
- Python3.7 AttributeError: module ‘time‘ has no attribute ‘clock‘
- Python AttributeError: module ‘tensorflow‘ has no attribute ‘InteractiveSession‘
- [Solved] PyQt: RuntimeError: wrapped C/C++ object has been deleted & has no attribute of flush in python
- [Solved] Python Keras Error: AttributeError: ‘Sequential‘ object has no attribute ‘predict_classes‘
- How to Solve Python AttributeError: ‘dict’ object has no attribute ‘item’
- [Solved] Selenium python send_key error: list object has no attribute
- Python Openyxl Error: AttributeError: ‘int‘ object has no attribute ‘upper‘ [How to Solve]
- Python writes DICOM file (attributeerror: ‘filemetadataset’ object has no attribute ‘transfersyntax uid’ solution)
- [2021-10-05] Python Error: AttributeError: ‘NoneType‘ object has no attribute ‘append‘
- [Solved] Python Error: AttributeError: partially initialized module ‘keyword‘ has no attribute ‘kwlist‘
- [Solved] python Error: AttributeError: ‘NoneType‘ object has no attribute ‘split‘
- Python3.6 Run uvicorn Error: AttributeError: module ‘asyncio‘ has no attribute ‘run‘
- [Solved] Operator Not Allowed In Graph Error & Attribute Error Tensor object has no attribute numpy