在導入python(tab)模塊時報錯

在導入python的模塊時會報錯:python

    配置文件:    
ide

                    

                    #!/usr/bin/env pythonspa

                    # python Tab fileit

                    import sysclass

                    import readlineimport

                    import rlcompleter軟件

                    import atexit配置

                    import osfile

                    readline.parse_and_bind('tab:complete')下載

                    histfile = os.path.join(os.environ['HOME'], '.pythonhistory')

                    try:

                        readline.read_history_file(histfile)

                    except IOError:

                        pass

                    atexit.register(readline.write_history_file,histfile)

                    del os,histfile, readline, rlcompleter

                    

直接在crt操做複製進tab.py不成功,會各類報錯:

        提示line1,line2之類的

    

那是由於在複製進去的時候有些字符被更改了

    解決辦法:

                    1.yum install lrzsz (安裝上傳下載軟件)

                    2.在電腦上新建一個名爲tab.txt的文件,而後將配置內容複製進去;保存,修改tab.txt爲                          tab.py

                    3.rz(上傳命令)

                    4.在調出來的文件框裏選擇剛剛建立的tab.py

                    5.whereis python(查看python模塊放在那個文件夾下)

                                python: /usr/bin/python /usr/bin/python2.6 /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/share/man/man1/python.1.gz  (跳出好多個目錄,有些是文件不是目錄,不清楚模塊在哪一個目錄下的能夠cd切進去看看)


                    6.cp tab.py /usr/lib64/python2.6(將剛剛上傳的tab.py文件拷貝到python模塊目錄下)

                    7.python(進入python)

                            而後輸入import tab.py(導入tab模塊)

便可

相關文章
相關標籤/搜索