ubuntu-安装了mysqlconector 后然无法引入

WBOY
發布: 2016-06-06 09:38:05
原創
948 人瀏覽過

mysqlubuntupython

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

<code> 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 linux2Type "help", "copyright", "credits" or "license" for more information.>>> import mysql.connector>>> exit()</code>
登入後複製

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

<code> (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 linux2Type "help", "copyright", "credits" or "license" for more information.>>> import mysql.connectorTraceback (most recent call last):  File "<stdin>", line 1, in <module>ImportError: No module named mysql.connector</module></stdin></code>
登入後複製

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

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!