Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Create Setup.py file with PyCharm
Qt 6.11 is out! See what's new in the release blog

Create Setup.py file with PyCharm

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
7 Posts 4 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PythonQTMarlem
    wrote on last edited by PythonQTMarlem
    #1

    Hello,

    I program with PyCharm 2020.1.3, Python Python 3.7.6
    and Qt version 5.9.7
    I want to create a Setup.py file using PyCharm.
    I would like to query the operating system in Setup.py
    and execute the correct command depending on the operating system
    Install Qt.

    Question:
    How do I do something or where can I find information about this?

    jsulmJ JonBJ 2 Replies Last reply
    0
    • P PythonQTMarlem

      Hello,

      I program with PyCharm 2020.1.3, Python Python 3.7.6
      and Qt version 5.9.7
      I want to create a Setup.py file using PyCharm.
      I would like to query the operating system in Setup.py
      and execute the correct command depending on the operating system
      Install Qt.

      Question:
      How do I do something or where can I find information about this?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @PythonQTMarlem

      import platform
      platform.system()
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P PythonQTMarlem

        Hello,

        I program with PyCharm 2020.1.3, Python Python 3.7.6
        and Qt version 5.9.7
        I want to create a Setup.py file using PyCharm.
        I would like to query the operating system in Setup.py
        and execute the correct command depending on the operating system
        Install Qt.

        Question:
        How do I do something or where can I find information about this?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @PythonQTMarlem
        @jsulm's platform.system() may be fine, I don't know. Personally I used

        import os
        
        def isWindows() -> bool:
            # return whether the current OS is Windows
            return os.name == "nt"
        
        
        def isLinux() -> bool:
            # return whether the current OS is Linux
            return os.name == "posix"
        
        1 Reply Last reply
        1
        • P Offline
          P Offline
          PythonQTMarlem
          wrote on last edited by PythonQTMarlem
          #4

          Thank you for both answers.
          What I'm still interested in:
          If I want to create a Setup.py file in PyCharm, is there a certain procedure or can I simply create a new file called setup.py?

          I made operating system queries like this:
          def operatingsystemqueries ():

          os_info = sys.platform
          print ("operating system:" + os_info)
          

          Possible expenses:
          Issue 1: Operating System: win32 Issue 2: Operating System: linux

          @jonB
          Is your method better?

          JonBJ 1 Reply Last reply
          0
          • P PythonQTMarlem

            Thank you for both answers.
            What I'm still interested in:
            If I want to create a Setup.py file in PyCharm, is there a certain procedure or can I simply create a new file called setup.py?

            I made operating system queries like this:
            def operatingsystemqueries ():

            os_info = sys.platform
            print ("operating system:" + os_info)
            

            Possible expenses:
            Issue 1: Operating System: win32 Issue 2: Operating System: linux

            @jonB
            Is your method better?

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #5

            @PythonQTMarlem said in Create Setup.py file with PyCharm:

            Is your method better?

            Nope, they are all fine, they just produce different strings. I happen to notice that @jsulm's platform.system() produces Linux with a capital L, so you'd have to be careful checking in Python.

            If I want to create a Setup.py file in PyCharm, is there a certain procedure or can I simply create a new file called setup.py?

            You can just go File > New..., pick Python file type, give it a name. Then PyCharm has added it right into your project.

            1 Reply Last reply
            1
            • P Offline
              P Offline
              PythonQTMarlem
              wrote on last edited by
              #6

              @JonB said in Create Setup.py file with PyCharm:

              You can just go File > New..., pick Python file type, give it a name. Then PyCharm has added it right into your project.

              Thank you!

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi,

                As posted in your other thread, unless you have very specific needs, installing dependencies should be done using python's package manager. Use a proper dependency list to trigger their installation.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved