首页 文章

我无法在Ubuntu VM中访问IDLE中新安装的python 3模块/库

提问于
浏览
1

我有一个python web爬虫,我想将它解析的信息写入MySQL数据库 .

我有MySQL和python,一切都安装好了 . 我的问题是我需要一个库来连接python和MySQL . 我尝试使用apt-get或pip安装库 . 它正确下载 . 但是当我转到IDLE并尝试从库中导入模块时,它只是说没有模块 .

我一直在寻找,但我看到的每个例子都是无法安装的人的问题 . 似乎我的问题是终端和IDLE以某种方式运行不同版本的Python?当我试图在终端中查找python的版本时,它说我正在运行2.7.10,但在IDLE中它表示3.4.3 . 我无法找到一种方法来表达这个问题,找到任何有用的结果,所以很抱歉,如果每天都这样问这个问题 .

更多信息:

使用Ubuntu 15.10运行Oracle VM VirtualBox的Windows 10操作系统 .

终端说Python 2.7.10,IDLE说Python是3.4.3

我尝试通过apt-get,pip和/或easy_install安装的库:PyMySQLMySQLdb,mysql.connector(显然我不能发布更多链接)

错误消息:在终端中:

draav@Ubuntu-VirtualBox:~$ pip3 install PyMySQL3
Downloading/unpacking PyMySQL3
  Downloading PyMySQL3-0.5.tar.gz
  Running setup.py (path:/tmp/pip-build-cj27_k_q/PyMySQL3/setup.py) egg_info for package PyMySQL3

Installing collected packages: PyMySQL3
  Running setup.py install for PyMySQL3

Successfully installed PyMySQL3
Cleaning up...

在IDLE:

>>> import PyMySQL3
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    import PyMySQL3
ImportError: No module named 'PyMySQL3'

1 回答

  • 0

    您应该使用 python3pip3 来引用Python 3.x安装,因为简单的 pythonpip 默认引用Python 2.x.

相关问题