skip to Main Content

Edit: It’s working fine now, it seems there was just something weird going on with VSCode

I am writing a discord bot in Python using Gitpod (which has VSCode Browser as its editor). I have installed Pycord 2.0 in the workspace using pip (obviously) but VSCode doesn’t seem to be recognising it. I also have the Python VSCode extension installed which adds a ‘Run’ to the editor when a python file is selected. It used to work just fine but since a month ago it stopped working and the ‘Run Code’ button is running some sort of Python installation where none of the modules I installed are there. It also doesn’t show any code hints for the modules.

I have tried pip show py-cord and changing the selected VSCode python interpreter accordingly. I’ve also tried changing th interpreter and installing Pycord into that interpreter but none of that worked.
I am running Gitpod on an iPad 6 (model A1893, iPadOS 15.6.1) in Safari

Does anyone know what might be wrong?

Thanks 🙂

~ R2509

2

Answers


  1. Many developers have multiple python versions installed, and multiple environments with the same python versions, but different libraries installed. Therefore, we need to specify which python compiler VSCode needs to use.

    Check on the bottom right of your VSCode, there should be a number down there representing an installation of python.

    Python version

    Upon clicking on it, VSCode will open a window on the top part, allowing you to select which of the many pythons you have installed you want to use. Find the one where you installed your libraries, and you should be good to go.

    Login or Signup to reply.
  2. Method one:

    • Use pip show Pycord to see where you installed the package Pycord

      enter image description here

    • then choose that environment

    Method Two:

    • Choose a python version you want to use ( Ctrl+Shift+P –> Python:Select Interpreter )

      enter image description here

    • Create a new terminal activation environment

      enter image description here

    • Install the package using pip install pycord in the new terminal

      enter image description here

    As a suggestion:

    you can use a virtual environment to better manage python versions and various packages.

    # Create a virtual environment named .venv
    python -m venv .venv
    
    # Activate this virtual environment
    .venvscriptsactivate
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search