Just gone through the process of setting up python and all the installs using cmd and now i want to use
brownie bake
To clone some code and it gives errors as it cant locate brownie... I've set environmental variables for the path (that's how I got it to work in cmd)... I've installed the python extension and chose the python.exe file in my new install in the compiler by clicking the bottom left... How can I make visual studios Code use only the python and all library's I installed?
if i run
python
in the terminal it opens up windows store for python install but i can run my version by using
py
First, Disable the python command to open the windows store:
Search Manage app execution aliases and unselect App Installer of Python:
Second, You need to check which python you have installed your packages to:
And make sure in the VSCode you have selected the right interpreter(In the following picture, they are different).
Related
I have installed python using Visual Studio, but I can't use python from the command prompt. I also want to run python from the command prompt, but it is only accessible from Visual Studio. I have tried adding the path of the directory in which Visual Studio has installed python to the user environment variables, but typing python in the command prompt opens up Windows Store.
Please somebody help me with this. Is there any way around or do I have to install python separately too.
go to python.org and download the latest version of python (You can download it from the windows store too). Then open a new terminal and write python --version.
NOTE: Don`t forget the open a new terminal.
step1 : install the python from python.org (dont forget to check the PATH installation radio button)
step2: check the python from CMD with command :
python --version
step3: go the project directory and run :
python your_project_file_name.py
thanks for replying. I figured out the answer myself, and thought to answer it for anyone in the future who comes across the same issue.
I went into settings->Apps
Find the python installation and click on it, select modify.
Then click on "modify installation" when the python installation repair window opens, then again click on "modify", make sure to select "Add python to path", and also py launcher option also.
That fixed the problem for me.
Thanks, again.
I'm learning python and use VS Code as the editor and when I try to run the .py file I get the following message ,
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
3 Ways to solve this :-
If Python is not installed,then install it from python.org
If its already installed then it might not have been added to path.
To add python to path, search for environment variables in search bar, then edit the path option and add the python installation directory location there.
OR you may just re-install python from python installer and tick the "add python to path" option
Plus I would not recommend using windows store version of python. Just use normal python installer from python.org
Image case for the problem
I was following the Visual Studio Code tutorial for python here
https://code.visualstudio.com/docs/python/python-tutorial
I downloaded Python, installed the python extension in Visual Studio Code and set the python interpreter to python3.8 . I also checked the workspace settings to see if it had given the correct path. Then, I wrote a simple hello world program but this is the error it is giving me.
This is the python path it has in the settings.
C:\Users\Dell\AppData\Local\Microsoft\WindowsApps\python.exe
Program:
print("Hello World")
Error:
C:/Users/Dell/AppData/Local/Microsoft/WindowsApps/python.exe c:/Users/Dell/hello/hello.py
-bash: C:/Users/Dell/AppData/Local/Microsoft/WindowsApps/python.exe: No such file or directory
I tried uninstalling and installing all the extensions again but it didn't work. I also uninstalled and installed all python related things on my computer. That didn't work either. What should I do?
reinstall python and this time, add python to the PATH (there is an option on the installation screen. Check it as it isn't checked by default). Then try running vs
Your environment path is not configured properly reinstalling python will fix this make sure you install python from actual application and not from vscode.other solution is that you can set the enviornment path manually just go to the environment variables> under user variable set the path to your python.exe the above mentioned location seems unlikely it should contain main python folder such as Python37/....
I will suggest you follow the link mentioned in this blog post to have python installed and working with Visual Studio Code. https://techdirectarchive.com/2023/01/17/getting-started-with-python-automation-in-windows-with-visual-studio-code/
Microsoft recommends installing python from the Microsoft Store. since installing from the Microsoft Store uses the basic Python3 interpreter, and handles the set-up of your PATH settings for the current user (avoiding the need for admin access), in addition to providing automatic updates.
I was working with Visual Studio Code and Python 3.7 installed in the default installation directory (\users\user\appdata\roaming), but when I updated my Python installation to the last version, "3.9.1", and after deleting all previous versions, I decided to install it in another directory (C:\Python), my Visual Studio Code does recognize my Python installation as you can see below:
But when running Visual Studio Code again, it tells me that Pylint isn't installed, logical since I deleted everything from the previous installation.
The problem I'm facing right now is that when I install "pylint" it keeps installing in the default Python directory (\users\user\appdata\roaming) and telling me to add it to the "environment variables".
How can I configure Visual Studio Code to install all libraries/modules in my new Python directory (C:\Python)?
An environment variable tells your system where the python.exe file is located. Pylint doesn't know where python.exe is. Use these steps:
Right-clicking This PC and going to Properties
Clicking on the Advanced system settings in the menu on the left
Clicking on the Environment Variables button on the bottom right
In the System variables section, select the Path variable and click on Edit. The next screen will show all the directories that are currently a part of the PATH variable
Clicking on New and entering Python’s install directory
I'm trying to create some script using this IDE but I can't make it work. I installed Python 3.6, added to path (it's visible finally), installed Python extension (from Microsoft I believe).
Then I tried this manual https://code.visualstudio.com/docs/python/environments but I'm stuck on the first step.
When I try the command Select Workspace interpreter I have the following error:
command 'python.setInterpreter' not found
I'm puzzled what it means. Google can't find anything on this issue, only some github pages that don't exist anymore.
And if I try to start debugging it shows:
command 'python.python-debug.startSession' not found
OS: Windows 7
Also I want to test scripts created in virtual environment, maybe it's a reason why it doesn't work but I have no idea how to do it.
UPD: I uninstalled and installed the extension again. I don't see these error but debugging still doesn't work just loading CPU and ignoring any breakpoints.
It worked for me going into ~/.vscode/extensions/, deleting the extension's folder manually and reinstalling it again.
In vscode do the following...
ctrl + shift + p
Select Python: Create Terminal. this should get rid of "command
'python.setInterpreter' not found" problem
ctrl + shift + p
Select Python: Select Interpreter
Select the path to your virtual environment folder. This will now create a
.vscode folder in the root directory of your folder and the settings file
with "python.pythonPath": "venv\\Scripts\\python.exe" in it
You might get "Linter pylint not installed" notification at the bottom
Run pip install -U pylint
Open a document and you should not see the notification anymore
One way to tackle this problem in Visual Studio Code is to the downgrade the version of Python extension from Microsoft. It can be very easily done through the Visual Studio Code interface. Locate the installed extension using the extension tab, and right click on the extension. Then You will find an option "Install Another Version...". Click on that and you will find a bunch of versions. Select the one that was published, for example, a month ago. Try to see if it works. If it does not, try with the other (preferably older) ones.