簡體   English   中英

我已經在 python 2 中編寫了一個代碼,現在我想在 python3 中執行它,我收到錯誤

[英]I have written one code in python 2 now i want to execute this in python3, i am getting error

from sqlalchemy import create_engine
        import pymysql
        import pandas as pd
        db='mysql+pymysql://developer:11111@192.168.1.11:3306/pos'
        db_connection=create_engine(db)
        df=pd.read_sql_table(table_name='product2', con=db_connection)
        #df1=pd.read_sql_table(table_name='product', con=db_connection)
        start_date = '2009-10-19 00:00:00'
        end_date = '2010-10-19 23:59:59'
        mask = (df['DateCreated'] > start_date) & (df['DateCreated'] <= end_date) #DateFilter
        df = df.loc[mask]
        t_type=(df['TherapyType']=='C')
        df = df.loc[t_type]
        df


     i am getting this error :-

            ModuleNotFoundError                       Traceback (most recent call last)
            <ipython-input-1-5c4885ab0640> in <module>
                  1 #extract the data from the created table in which dataframe was inserted..
            ----> 2 from sqlalchemy import create_engine
                  3 import pymysql
                  4 import pandas as pd
                  5 db='mysql+pymysql://developer:devdev@192.168.1.44:3306/pos'

            ModuleNotFoundError: No module named 'sqlalchemy'

我在 python 2 中編寫了一個代碼,我想在 python 3 中執行此代碼,但出現錯誤,我無法理解我應該怎么做

sudo pip3 install sqlalchemy,

sudo pip3 install PyMySQL,

我使用這兩個命令安裝了sqlalchemypymysql ,現在我沒有收到任何錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM