virtualenv中解决报错:ImportError: No module named MySQLdb
其中:2env为使用virtualenv创建的虚拟环境, lianxi目录为我已下载好各类的离线库包(按自己的使用需要去下载),ceshi4.txt是我本次想要安装的库列表
(2env) [root@xxxx]$ ./2env/bin/python wsgi.py
[warning] no local config file
2020-06-30 17:45:24 INFO:Starting new HTTPS connection (1): oidc.ksyun.com
2020-06-30 17:45:24 DEBUG:"GET /.well-known/openid-configuration HTTP/1.1" 200 887
Traceback (most recent call last):
File "wsgi.py", line 12, in <module>
from rrd import app
File "/xxxx/rrd/__init__.py", line 39, in <module>
from view.dashboard import chart, screen, api, servicetree
File "/xxxx/rrd/view/dashboard/screen.py", line 12, in <module>
from rrd.model.graph import DashboardGraph
File "/xxxx/rrd/model/graph.py", line 7, in <module>
from rrd.store import dashboard_db_conn as db_conn
File "/xxxx/rrd/store.py", line 2, in <module>
import MySQLdb
ImportError: No module named MySQLdb
解决办法:
单独重新安装,pip install --no-index --find-links=qin -r ./ceshi4.txt --target=2env/lib/python2.7/site-packages