Python Tutorial

How To Change Python Interpreter In Eclipse Pydev Project To Use Different Python Virtual Environment Library

When i develop a python program in eclipse pydev project, i need to import a package pymongo into this python program like below source code. import pymongo if __name__ == ‘__main__’: pass But it shows an error message Unresolved import: pymongo in the source code, you can see this error message when you move your mouse …

How To Change Python Interpreter In Eclipse Pydev Project To Use Different Python Virtual Environment Library Read More »

How To Fix Failed To Unlink Socket File Error When Start Mongo DB On MacOS

When i start mongo db on macOS console by run command mongod, i got below error message. {“t”:{“$date”:”2020-09-09T10:45:30.049+08:00″},”s”:”E”,  “c”:”NETWORK”,  “id”:23024,   “ctx”:”initandlisten”,”msg”:”Failed to unlink socket file”,”attr”:{“path”:”/tmp/mongodb-27017.sock”,”error”:”Permission denied”}}

How To Find Where Python Modules Stored

In this article, i will tell you 3 methods to find where a python module stores as below. Find python module in sys.path. The python sys module’s path attribute save all python module stored path. Then you can find your python module in the output path directory. >>> import sys >>> >>> sys.path [”, ‘C:\\Users\\zhaosong\\anaconda3\\envs\\python_example\\python38.zip’, …

How To Find Where Python Modules Stored Read More »

How To Fix Python Subprocess Run Error FileNotFoundError: [winerror 2] The System Cannot Find The File Specified

When i execute a system program use python subprocess module’s run method in windows, i meet an error message like below. >>> import subprocess >>> subprocess.run([“dir”, “/p”]) Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “C:\Users\zhaosong\anaconda3\envs\env_python_37\lib\subprocess.py”, line 488, in run with Popen(*popenargs, **kwargs) as process: File “C:\Users\zhaosong\anaconda3\envs\env_python_37\lib\subprocess.py”, line 800, in __init__ …

How To Fix Python Subprocess Run Error FileNotFoundError: [winerror 2] The System Cannot Find The File Specified Read More »