Recreating PyCharm launcher in Ubuntu

后端 未结 17 1248
一向
一向 2021-01-30 06:16

I installed pycharm normally via bin/pycharm.sh, but the mistake I made was doing bash pycharm.sh while the pycharm directory has inside the D

17条回答
  •  误落风尘
    2021-01-30 07:03

    you can always use python for automation may be this will help you a python script that allows u to run pycharm as user or sudoers/root

        import os
        from time import sleep
        sleep(1)
        program = input('which program to run: >')
    
        if program == "pycharm":
            os.chdir('#full path to pycharm paste here')
            root = input('run as root(y/n): >')
            if root == 'y':
                print('started ' + program + ' as root')
                sleep(0.5)
                print('please enter root password to continue:')
                os.system('sudo ./pycharm.sh')
            elif root == 'n':
                print('running ' + program + ' as non root')
                os.system('./pycharm.sh')
        elif program != 'pycharm':
            print('program not found')
    

提交回复
热议问题