Python ModuleNotFoundError:没有名为“mysql”的模块

2024-05-29 06:21:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我的系统是ubuntu18.04,在那里我安装了python3.6。你知道吗

我正在运行一个脚本,它有下面的lib

import mysql.connector
from google.cloud import storage

当我运行的纸条,我得到如下错误

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)

你知道吗根目录@sysadmin-ThinkPad-X250:#pip3.6安装mysql connector python 需求已经满足:mysql connector python in/usr/lib/python3/dist包(2.1.6)

#!/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

Tags: nofromimportcloudconnectorlibusrgoogle
1条回答
网友
1楼 · 发布于 2024-05-29 06:21:41

使用诸如pipenv或virtualenv之类的依赖关系管理工具可以避免这种情况。您将避免许多潜在的麻烦,尤其是在基于Linux/UNIX的系统上。你知道吗

相关问题 更多 >

    热门问题