问题:安装完包无法导入
安装出现:
[root@a928bac91186 project]# pip install django==2.2
Requirement already satisfied: django==2.2 in /usr/local/lib/python3.6/site-packages (2.2)
Requirement already satisfied: sqlparse in /usr/local/lib/python3.6/site-packages (from django==2.2) (0.4.3)
Requirement already satisfied: pytz in /usr/local/lib/python3.6/site-packages (from django==2.2) (2022.7)
查看导入情况
>>> import sys
>>> print(sys.path)
['', '/usr/local/python3/lib/python39.zip', '/usr/local/python3/lib/python3.9', '/usr/local/python3/lib/python3.9/lib-dynload', '/usr/local/python3/lib/python3.9/site-packages']
>>>
发现没有该安装路径
解决:
vi /etc/profile
export PYTHONPATH=/usr/local/lib/python3.6/site-packages/
source /etc/profile
即可!
标签:named,lib,site,django,usr,2.2,ModuleNotFoundError,local From: https://www.cnblogs.com/yu121/p/17039122.html