ImportError: No module named _ssl
Did you build the Python from source? If so, you need the --with-ssl
option while building.
ImportError: No module named _ssl occurring even when /usr/lib64/python2.7/lib-dynload/_ssl.so is available fc18
I finally figure out the issue. There were 2 python installations. The installation i was checking for openssl lib, contained the file. But by default other installation of python was being used for running the programs. Once I switched to correct python installation, the error went away.
Trouble using pyinstaller No module named '_ssl'
I finally find the solution.
For people who facing the same trouble:
Here is the command I use for create the binary file:
pyinstaller --hidden-import _ssl --hidden-import engineio.async_gevent --hidden-import engineio.async_eventlet --hidden-import ssl ./server_websocket.py -y
I also need to modify the socketIO call:
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app, async_mode='gevent')
And import that:
from engineio.async_drivers import gevent
ImportError: No module named _ssl with dev_appserver.py from Google App Engine
You can test if ssl is available at your local system by opening a python shell and typing import ssl
. If no error appears then the problem is something else, otherwise you don't have the relevant libraries installed on your system. If you are using a Linux operating system try sudo apt-get install openssl openssl-devel
or the relevant instructions for your operating system to install them locally. If you are using windows, these are the instructions.
How to import _ssl in python 2.7.6?
I fixed the problem finally!
The _ssl module is a built-in module for python, but it requires openssl installed on your system.
Change to root user first!
1.Install openssl and libssl-dev.
If on debian OS
apt-get install openssl
apt-get install libssl-dev
2.Recompile python
cd Python2.7.6
./configure
make && make install
But actually, I fix the problem in this way!
1.Install openssl
I download a package from the Internet, which is openssl-1.0.2d.tar.gz
tar zxvf openssl-1.0.2d.tar.gz
cd openssl-1.0.2d
./config -fPIC //configuration:create path independent libssl.a
make && make install
2.Recompile python2.7, and make it support ssl module
tar xvf Python-2.7.6.tar
cd Python-2.7.6
vim Modules/Setup.dist
find the following line and uncomment it.(use /ssl+Enter to quickly locate these lines in vim)
# Socket module helper for socket(2)
_socket socketmodule.c timemodule.c
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
and then config and make, make install
./configure --enable-shared //--enable-shared option means to generate dynamic library libpython2.7.so.1.0
make && make install
Our project depends on libpython2.7.so.1.0. Now I can "import ssl" or "import _ssl" successfully in my python script or python interpreter with the new libpython2.7.so.1.0.
Related Topics
How to Unzip a List of Tuples into Individual Lists
Validate Ssl Certificates with Python
Python: Simple List Merging Based on Intersections
Python - Is a Dictionary Slow to Find Frequency of Each Character
Coalesce Values from 2 Columns into a Single Column in a Pandas Dataframe
Is the Server Bundled with Flask Safe to Use in Production
Underscore _ as Variable Name in Python
Custom Filter in Django Admin on Django 1.3 or Below
Reading a Text File and Splitting It into Single Words in Python
How Does Condensed Distance Matrix Work? (Pdist)
Pip Installing in Global Site-Packages Instead of Virtualenv
Find the Recaptcha Element and Click on It -- Python + Selenium
Increment a Python Floating Point Value by the Smallest Possible Amount
What Is _Future_ in Python Used for and How/When to Use It, and How It Works
How Did Python Implement the Built-In Function Pow()
When and How to Use the Builtin Function Property() in Python