Python – How do I view Python modules? They are .so files, and PyCharm does not recognize how to open them

How do I view Python modules? They are .so files, and PyCharm does not recognize how to open them… here is a solution to the problem.

How do I view Python modules? They are .so files, and PyCharm does not recognize how to open them

I would like to understand how some modules work. I thought they would be .py documents that would teach me the inner workings back then. However, when I import a module, it says it’s from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload/math.cpython-36m-darwin.so

I went to the lib-dynload folder under the PyCharm external library, but the module files are all “.so” files.

What is a .so file?

How do I view the .so file and understand the code in it?

If it’s not obvious, I’m new to python, so please describe your answer.

Solution

The .so file is a native shared library. They are written in C instead of Python. If you’re curious about them, check out Python’s source code

Related Problems and Solutions