我在Pycharm中安装了sqlalchemy软件包
运行程序:python datagenerator
,我收到此错误:
Traceback (most recent call last):
File "C:\Users\Matt\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Matt\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "datagenerator\__main__.py", line 2, in <module>
import database
File "datagenerator\database.py", line 1, in <module>
from sqlalchemy.orm import sessionmaker
ModuleNotFoundError: No module named 'sqlalchemy'
它所在的目录是源根目录。
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
engine = create_engine("postgresql://matt:database@localhost/test")
Session = sessionmaker()
我对另一个模块也有同样的问题。
主要:
import sys, argparse
import database
from generator import Generator
from funcmodule import my_function
def main():
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--s', dest='s', nargs='+')
parser.add_argument('--u', dest='u', nargs='+')
parser.add_argument('--c', dest='c', nargs='+')
args = parser.parse_args()
if args.series:
database.series()