Python ModuleNotFoundError:没有名为';mysql';
我在Ubuntu 18.04系统中安装了python 3.6 我正在运行一个脚本,其中包含以下库Python ModuleNotFoundError:没有名为';mysql';,python,python-3.x,module,mysql-connector,mysql-connector-python,Python,Python 3.x,Module,Mysql Connector,Mysql Connector Python,我在Ubuntu 18.04系统中安装了python 3.6 我正在运行一个脚本,其中包含以下库 import mysql.connector from google.cloud import storage 当我运行scrip时,我得到如下错误 ModuleNotFoundError: No module named 'mysql' ModuleNotFoundError: No module named 'google' 但我已经安装了这些模块,不知道是什么问题。有人能帮忙吗 root@
import mysql.connector
from google.cloud import storage
当我运行scrip时,我得到如下错误
ModuleNotFoundError: No module named 'mysql'
ModuleNotFoundError: No module named 'google'
但我已经安装了这些模块,不知道是什么问题。有人能帮忙吗
root@sysadmin-ThinkPad-X250:# pip3.6 install mysql-connector-python
Requirement already satisfied: mysql-connector-python in /usr/lib/python3/dist-packages (2.1.6)
root@sysadmin-ThinkPad-X250:#pip3.6安装mysql连接器python
已满足要求:mysql连接器python位于/usr/lib/python3/dist包中(2.1.6)
使用依赖关系管理工具(如pipenv或virtualenv)可以避免这种情况。您将避免许多潜在的麻烦,尤其是在基于Linux/UNIX的系统上。如何运行python脚本?你只是在命令行中键入
python myscript.py
吗?我猜这是Python2和Python3的双重安装问题?我猜可能是python-m some dir.myscript
和python some dir/myscript.py
的问题,也许吧。@JohnGordon:我以python3.6 script_name.py的形式运行脚本。您能给我们看一下print(sys.path)
的输出吗?
#!/usr/bin/env python3
from __future__ import division
import time
import os
import datetime
import csv
import threading
import concurrent.futures
import mysql.connector
from os.path import join, getsize
from google.cloud import storage