Reset python path after Anaconda - python

I used IDLE for some time, then for a class they told us to download Anaconda, which I ended up not using, but still downloaded it anyway.
I uninstalled anaconda and deleted all the files from my CPU and started using IDLE again. I now can't import a module to IDLE because it can't find it. I think anaconda messed up the python path, but I don't know how to change it so I can import modules back to python.
How can I determine what the python path is and how can I change it so when I download modules I can import them to IDLE again?
I am running OsX 10.10.5 and Python 2.7.10.

To add the python path for anaconda if you are on windows:
Right click my computer
Go to advanced settings
Click on environment variables
Find the PATH variable and click edit
Add the path where your python.exe file is located
Example:
C:\Anaconda3 - might not work
C:\Anaconda3 - then this should work
Same thing for those, who have other installations.

Like #lsxliron mentioned in his comment you should probably check your .bash_profile and make sure that anaconda isn't in your PATH. It should have added itself there during the installation.
You might also want to confirm that IDLE isn't still pointing to the anaconda python that you've now removed.
Also check this question for more details on uninstalling anaconda on OS X.

Related

VS Code: "The isort server crashed 5 times in the last 3 minutes..."

I may have messed up some environmental path variables.
I was tinkering around VS Code while learning about Django and virtual environments, and changing the directory path of my Python install. While figuring out how to point VS Code's default Python path, I deleted some User path variables.
Then, isort began to refuse to run.
I've tried uninstalling the extension(s), deleting the ms-python.'s, and uninstalling VS Code itself, clearing the Python Workspace Interpreter Settings, and restarting my computer.
Even if it's not my path variables, anyone know the defaults that should be in the "user" paths variables?
Another reason maybe that you are using a python version older than 3.7, which isort is not supporting anymore. Here is a reference link.
You need to find the location of the python.exe file.
Usually it is C:\Users\Admin\AppData\Local\Programs\Python\Python310\
You can also automatically add python to the system environment by deleting and reinstalling it. During installation, a small box is automatically checked to add environment variables.
I ended up refreshing my Windows install. Was for the best because I'm repurposing an older machine anyway.
I also had this error on one of my windows machines. I don't know why the isort extension only chrashed on this machine and worked well on the other windows machines.
I fixed it by manually setting the path to python.exe in the settings of the isort extension:
In VSCode go to Settings > Extensions > isort > Interpreter and enter the path to python.exe for example:
C:\WinPython\WPy64-39100\python-3.9.10.amd64\python.exe

in vscode, pygame wont import but it is installed and is working in the windows console ,and the python app thing

im very new to code in general so this could be a stupid beginner problem ive searched for things but i couldnt find something useful for me
under Problems is the message: Import "pygame" could not be resolved
You can use pip show pygame to view the package installed location.
And check whether the installation location is consistent with the version corresponding to the selected Python interpreter.
There are two ways to solve this problem:
"ctrl+shift+P" and change the python interpreter.
If you don't want to change the interpreter, you can use pip -t flodername pygame #flodername is your used python package location. Install the pygame package to the specified directory
First, try restarting your computer or vs code
Use this command in your vs code terminal if the above doesn't work:
pip uninstall pygame
Then reinstall pygame using:
pip install pygame
If this also does not work then follow these steps:
Go to the scripts folder of python.
Open command prompt or Powershell in the script folder.
Use this:
C:\python34\scripts> python -m pip install pygame
Done
As an Anaconda user, I found my packages were being installed to C:\Users\YOUR_USERNAME\anaconda3\Lib\site-packages, which Visual Studio Code was not picking up on.
With the Pylance extension installed, open Settings (File > Preferences > Settings, or Ctrl+,)
At the top, beside Workspace, choose User
Under Extensions > Pylance, scroll until you find Python › Analysis: Extra Paths and select Add item.
Type in the path to which packages are being stored (in this case, C:\Users\YOUR_USERNAME\anaconda3\Lib\site-packages)
Click OK and after a couple moments, you should see something like the below image (i.e, the path is included in the list of paths).
Finally, your Python file should have picked up on the changes, but if not, reload it or VS Code. If nothing else, add another path that packages are being saved to or change your Python Interpreter. Using another virtual environment's interpreter wouldn't be very helpful, after all.
I may be late, but I hope this helped.

Python 3.9.1 path variable

Good day!
Installed the Python 3.9.1, checked "Add to path", the cmd did not work though.
Added Environment Variable Path, both folder
C:\Users\XXXXX\AppData\Local\Programs\Python\Python39
(file manager opens the path to python.exe just fine)
and script lines:
C:\Users\XXXXX\AppData\Local\Programs\Python\Python39
Still the commands python -version and pip --version do not work from the command line.
Py --version works just fine though.
Anyone might share and idea what might be the reason?
This happens more often than one would think.
When you installed python from python.org and follow the installer, post install, you should check your environment variables, and verify that you have no other python installation (or if you do just name them appropriately).
Often you can find that there is an Environment Variable, that includes a python version on the global Environment Variable Path.
To verify that you are targeting the correct python version put these two directories (replace, user and python version), at the top of your PATH (user's path), and check that there are no conflicts with the rest of the PATH variables.
C:\Users\XXXXX\AppData\Local\Programs\Python\PythonXX
C:\Users\XXXXX\AppData\Local\Programs\Python\PythonXX\Scripts
If you had Python installed in the system before, the new path is added at the end of PATH system variable and when system looks for python.exe it finds first the old version that is available under a different folder.
If you used a command window opened before the new version got installed, it is also possible that system variables did not reload. Close it and use a new one to check.

pipenv search python in old directory do not exist

I would to create new Python project which include pipenv for manage my packages.
But when I try to install package with it, it throw me I exception :
ValueError: Not a valid python path:
'C:/dev/Anaconda3/Scripts/python.exe'
I try pipenv command with 2 differents emulation terminal (Cmder and Terminus) which produce same result.
In old time a try Anaconda solutions for work with Python. But now I don't want use this and I uninstall Anaconda in my OS.
It seems that my OS keep old reference to this python executable into Anaconda in your PATH... But I display my 2 PATH variables OS (PATH system OS and PATH user) and nothing has this location path into your string.
The directory c:\dev\Anaconda3 doesn't exist !
I try to search uninstall Anaconda program in my tool application manager Windows but Anaconda is not diplayed in that listing. It seems to be good uninstalled.
I install correctly pipenv executable : pipenv --version
pipenv, version 2020.6.2
I install correctly python executable : python --version
Python 3.8.3
I added 3 differents PATH python for my OS PATH (system PATH and user PATH) :
C:\dev\python\Python38
C:\dev\python\Python38\Scripts\
C:\dev\python\Python38\Scripts\bin
Why I keep old reference to Anaconda program ?
Why many program search python in same old deleted path and PATH variable do not included this ?
How pipenv created his PATH environment variable ?
I had a Python2.7 instance giving me the same problem. I copy/pasted its python.exe into the Scripts folder. So it now found a real python.exe there. Once I did this it continued on happily. And now I was able to use the Python3.9 version i wanted it to use anyways.
It seems like the python searcher should be a little more tolerant and just ignore poorly formed python releases. There is an open ticket for this: https://github.com/pypa/pipenv/issues/4334
I had a similar error because of an incorrectly uninstalled Anaconda. To see if you have the same problem, go to System Settings > Add or remove programs, and check for anything unexpected matching "conda". Trying to uninstall it results in an error because the uninstall.exe file cannot be found.
Searching around, I saw a few posts that said to mess with regedit, but that's scary. Instead, I re-installed the version of Anaconda that I needed to uninstall (you can do that with https://repo.anaconda.com/archive/Anaconda3-2020.02-Windows-x86_64.exe, replacing 2020.02 with your Anaconda version), and then uninstalling it via the proper uninstaller via "Add or remove programs". After a restart, the phantom Anaconda python was gone
You need to delete the old path in the Windows Registry.
Hit win + r
regedit
find folders with (Anaconda3 or Miniconda3).
Probably two folders. Do not delete folders with the new path to Python.

anaconda python running py file

I downloaded python anaconda 2.7.
I used to work with the regular python from python.org, but I was asked to work with anaconda.
any how, I have 2 problems.
right click ->edit with idle (does not exist).
can't run py file as a program (like cmd)/.
After installing Anaconda, mostly the path environment variable is overridden hence the system now refers to the Anaconda python interpreter, a quick fix is to correct the path environment (this depends on the type of OS you're running).

Categories