VS Code Python youtube_dl will not import - python

I have tried every tutorial online and every troubleshooting I have installed youtube_dl in everyway possible all the pip commands and using the exe NOTHING will work I have tried adding it to PATH still nothing at this rate im thinking its an impossible error
Im using visual studio code

See the selected interpreter shown in bottom left corner, run pip show youtube_dl in terminal, check if its location is /selected interpreter/lib/site-packages.
If it is, reload window should solve your question.
If not, please open an integrated Terminal and reinstall the module to current selected python environment.

Related

Python was not found error when runnig code

After a few routine windows updates, I started getting this error when I was running python code in VSCode.
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
I got told to first check PATH and to untoggle Python in App Execution Aliasies. I figured that python was already added to the PATH (I had just checked the box when downloading) and that when I untoggle Python in App Execution Aliasies I get another error
'python3' is not recognized as an internal or external command, operable program or batch file.
So I'm essentially stuck between two different errors and a correct PATH and the only times when I can run a code is when I run it from the default Python IDE that comes in the download package.
Anyone know how to fix this?
PS. when I download Python from Windows Store, it works but I don't know how to use pip with it to install external packages.
Below is the pic of my PATH.
Please reinstall python. When you install python, there will be a prompt in the lower left corner to automatically add it to the environment variable. Please check it.
At the same time, please select the correct Python interpreter in vscode.
You can refer to docs for more information.

why is vscode throwing a false error that pygame is not installed

I currently have Python 3.10.5 and pygame 2.1.2.
VScode 1.70.2
Versions
For some reason there is the following warning: Image for warning
Import "pygame" could not be resolved PylancereportMissingImports
Even though I have the pygame library installed using "pip install pygame".
And when I run the file by pressing the "Run Python File" in the right top corner, it runs perfectly without an error. It even uses the terminal to show whatever I am printing.
My issue here is the warning and that intellisense for pygame isn't working.
What can I do to fix that.
I already tried to make a clean install on everything, python, pygame, even VScode. Nothing.
Try to reload vscode (by command pallete or just restart the app), reinstall pygame and make sure python path is selected. Also it is worth to trying selecting interpreter. Open command pallete and type: Python: Select Interpreter, then select your python version.
yes as the #NoBlockhit stated probably you have 2 different python versions installed and vs code choses the one without the pygame library (https://code.visualstudio.com/docs/python/environments) if you scrolldown it shows you how to chose an in interpreter...

Unable to Import & Import could not be resolved

i started programming today and i'm testing different code segments on Visual Studio Code. However, when i tried importing a "numpy", 2 errors occured. I then proceeded to check other stack-overflow posts regarding this and I tried switching the Python Interpreter, however nothing changed. I also attempted doing other suggestions, however I don't understand how to do some of the suggestions (its my first time programming etc.)
enter image description here
Below is a zoomed up picture of it
enter image description here
I was wondering if I could get some help?
Run
pip show numpy
in integrated terminal, check if its location is <your selected interpreter>\lib\site-packages.
If is, reload window then the error should go away.
If not, please open an integrated Terminal and reinstall the module to current selected python environment.
Try opening the project folder in VsCode instead of opening the file by itself. If that doesn't work, run the file through CMD, if running it through CMD doesn't work, you might not have the numpy library. You can do that by going to CMD and write the following command:
pip install numpy

How do I add pyinstaller to PATH?

I have a pygame project stored in C:\Users\name\GameProject. I followed instructions to create an exe by typing in pyinstaller --onfile -w game.py. However, every time it tells me that pyinstaller is not recognized as an internal or external command. I googled some answers, and apparently python is not in my path. The problem is, I've added everything I could to both the user path and system path. I even reinstalled python, checking add to path. Pyinstaller still is unable to make me an exe file. Can I have some insight on why this might be? I'm on windows 10, using python 3.9.
To everyone that has the same problem as me, if you are using PyCharm, make sure to install pyinstaller on the project interpreter as well! It worked for me.
If you don't know how:
Click file at the top left corner
Click settings
Find your project on the toolbar on the left
Click project interpreter
To the right there will be a plus sign
Click that and search pyinstaller
Install
Good luck!
I know that this might seem odd but try this:
try uninstalling python, then reinstalling it "make sure you press
add to PATH".
when you do install it again, restart your device and open the
command prompt.
type pip install pyinstaller.
I encountered the same issue and when I did this it worked perfectly.
it's definitely an environmental variable issue.

Pygame (on Python 3.7) installation in cmd prompt displays 'python' is not recognized

Edit: I reinstalled python 3.7 but this time I check the box while going through installation process to make it add Python to the Path ( something I tried but it just never worked for some reason). I followed the first link ( the video) step by step and got pygame installed pretty quickly. (:
I am running Python 3.7 and have pip installed with it, along with pygame downloaded. I have searched YouTube videos on how to download and get pygame to work and the most helpful video was: https://www.youtube.com/watch?v=vGb5EX3XjdI&t=116s
Meanwhile I also found out that I may need to change my PATH: https://www.pythoncentral.io/add-python-to-path-python-is-not-recognized-as-an-internal-or-external-command/
I've made a new path and I always make sure I am in the right drive but I still cannot for the life of me figure out why pygame cannot be installed and why windows command prompt tells me "'python' is not recognized as an internal or external command, operable program or batch file."
I am new to python programming and wanted to make my first application to be a simple tetris game or something but I am having issues figuring this one out. Thanks for any help if any comes my way.
To fix this, I suggest uninstalling and reinstalling python. Your problem was that you didn't add python to your PATH, so make sure you include that step when you're reinstalling it (it'll be a small check box, see below). As you can see, there is a checkbox that says "Add Python 3.6 to PATH". This essentially adds Python to CMD automatically. Best of luck.

Categories

Resources