安装了mysqlconector 后然无法引入

我在ubuntu14.4上面操作,python2.7,mysql5.5 ,用了virtualenv,
当我在虚拟环境外安装好mysql-connector-python_2.0.4-1ubuntu14.04_all.deb后可以正常使用,

 think@think-Inspiron-N4050:~/download$ sudo dpkg -i mysql-connector-python_2.0.4-1ubuntu14.04_all.deb 
[sudo] password for think: 
Selecting previously unselected package mysql-connector-python.
(reading databse ...)
Preparing to unpack mysql-connector-python_2.0.4-1ubuntu14.04_all.deb ...
Unpacking mysql-connector-python (2.0.4-1ubuntu14.04) ...
setting mysql-connector-python (2.0.4-1ubuntu14.04) ...
think@think-Inspiron-N4050:~/download$ python 
Python 2.7.6 (default, Jun 22 2015, 18:00:18) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mysql.connector
>>> exit()

我需要在virtualenv环境下使用,于是我又在venv环境里安装了一个,安装正常,但是无法引入

 (venv)think@think-Inspiron-N4050:~/download$ dpkg -i mysql-connector-python_2.0.4-1ubuntu14.04_all.deb 
(venv)think@think-Inspiron-N4050:~/download$ sudo dpkg -i mysql-connector-python_2.0.4-1ubuntu14.04_all.deb 
(reading database ... )
Preparing to unpack mysql-connector-python_2.0.4-1ubuntu14.04_all.deb ...
Unpacking mysql-connector-python (2.0.4-1ubuntu14.04) over (2.0.4-1ubuntu14.04) ...
setting mysql-connector-python (2.0.4-1ubuntu14.04) ...
(venv)think@think-Inspiron-N4050:~/download$ python 
Python 2.7.6 (default, Jun 22 2015, 18:00:18) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mysql.connector
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named mysql.connector

请各位老师指点一下,谢谢

1个回答

virtualenv中的mysql.connector安装没有成功,导致不能识别模块。

deyuzhi
is_thinking 回复oyljerry:没有找到,venv/lib/python2.7/site-packages里面没有,
大约 4 年之前 回复
oyljerry
oyljerry 回复is_thinking: 先看你的虚拟目录中site-packages等是否有安装
大约 4 年之前 回复
deyuzhi
is_thinking 但是也没有发现错误提示,安装过程中输出的信息是和virtualenv外安装输出信息一样的,不知道该怎么调试了,老师有什么好的方法吗?谢谢
大约 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!