pycharm import module error

Recently, I am writing a python program with pycharm, then import the os module, and use pip to install the module. It prompts that the module belongs to the built-in module of python, and it can be used directly without installation.
The problem is: since it can be used directly, why does import os always report an error? !
Solution: The os module is in the lib folder of python, and the pycharm search path is wrong, so change its search path.
File–>Settings–>Project Structure -->add Content Root–>python/lib

In addition, pip can change the source, and the download will be faster:
create a new pip folder in window/user/, create a new pip.ini file in it, and write
[global]
index-url = https://pypi.tuna.tsinghua.edu .cn/simple

Related Posts