Starting conda pompt from cmd - python

I want to start the conda Prompt from cmd, because I want to use the promt as a terminal in Atom.io.
There is no Conda.exe and the path to conda uses cmd to jump into the prompt. But how do I start it inside of cmd?

I guess what you want is to change to Anaconda shell using cmd, you can find the address for your Anaconda and run the following in your cmd:
%windir%\System32\cmd.exe "/K" "Address"\anaconda3
Or, you can find your Anaconda prompt shortcut, right click on that, and open its properties window. In the properties window, find Target. Then, copy the whole thing in Target and paste it into your cmd.

The answer to your question https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#starting-conda. Also check this guide https://docs.anaconda.com/anaconda/user-guide/.

Related

Python isnt recognized in cmd and i cant use pip

im pretty new to coding and stuff but for whatever reason, python, pip or even doing cd C:\Python38\scripts cmd will just tell me the directory isnt found or that it isnt a command, i did echo %PATH% and it is in there. (this is probably a really simple solution, im not advanced with stuff like this at all)
Open a new CMD with the start menu
go to the location where python is installed.
press on the Path next to Search Bar.
Copy, back to CMD, cd (paste)
This will set the working directory to where python is installed.
You can test now with python command, and check it it works , then the issue is only path related.
Now for checking with Path, You will need to add the complete path to the python.exe the one you just copied into CMD.
For example
C:\Users\George\AppData\Local\Programs\Python\Python39 at this path there will be a python.exe where You can execute with CMD.
If you have an issue with the path and have to update to the new one, Make sure to start a new CMD window to take the effects of the Path update.
You would need to add python in the PATH variable to access python from cmd in windows.
Please see the article at this link Adding python to Path
Post that you would be able to access pip from cmd/ use pip within cmd

Why isn't my virtualenv opening up in visual studio code?

I'm working with Django right now and when I installed it through the command prompt I made a virtualenv called test, now I went into vs code and I am trying to open it up by saying workon test but it's not going into the virutalenv. I am on windows and I am using visual studio code.
To open virtual env through command prompt,
run, activate.bat
\test\Scripts\activate.bat
for bash run,
source test/bin/activate
just go to the left below corner where your python version is written click it, it will open the command palette where select the virtual env. (with its name) that's is test and press ok.
After that open new terminal and you will get what you want
In cmd typing test/Scripts/activate worked, but in vscode terminal, I had to cd till the Scripts and then type .\activate.

pip.exe missing in python scripts module

correction
i edited the environment variable to path Scripts, but in the command prompt on typing the pip command it does not shows up the package installation
python\scripts location picture
While executing the pip command in the command prompt, it shows pip is not recognized as an internal or external command, operable program or batch file.
I tried setting environment variables and all other alternative solution still I am not able to solve it. I recently noticed pip.exe file missing from python/scripts module.
Is that reason to show up this error? if it is yes, how will I install it manually?
You should add the full directory to the Scripts folder to your PATH environment variable. When you run commands in a command prompt, Windows will search through the folders listed in PATH.
Assuming you are on Windows 10:
Press the start button then search "Environment Variables"
Click the "Edit Environment Variables" option.
Click the "Environment Variables" button in the box that pops up.
Scroll down and find the PATH variable, double click it.
Click "New"
Paste in the path to the Scripts folder.
Save it and exit, then restart the terminal. Now pip will be recognized.
Finally I solved it.I used python 3.8.3 version.Not folder named "Scripts" in this version.I just delete this version and reinstall python 3.7.8 version and then pip is here :D
I know this has been solved, but another way of dealing with this is to create an empty file in the 'Scripts' folder and rename it to pip.bat. Then add the following code:
python -m pip %*
Which simply passes all the arguments of the pip command to python.

Running Anaconda environment from cmd Python

When I open the anaconda prompt the window that opens, shows:
(base) C:\Users\sherv>
So I deactivate it and get:
C:\Users\sherv>
which is the same thing when I open cmd. From here there is there any way that I can reactivate conda? Because the command words like "conda -v" or "activate base", etc, don't work.
Also, the conda prompt is a shortcut so when I right-click and select "open file location", it goes to windows\system32\cmd. So I don't understand why I can't activate conda environments from cmd if it's the same thing?
This is the anaconda prompt shortcut:
When I open file location its the cmd:
I have even tried to add it to that path just in case it might work?
PS. I'm very new to all this and trying to connect some dots; sorry if it's a stupid question.
ok, so the path first opens the cmd (which is why the shortcut points at it, but then from there, from within the cmd, it runs C:\Users\sherv\Anaconda3\Scripts\activate.bat. Is there anyway I can have the batch file commands run from cmd without having to write out the path every time? I added the path for the batch file but it didn't work
The reason why the anaconda prompt shortcut leads to cmd is because it needs to open cmd first and then run a batch file which activates the conda environment. What I had done was to add the batch file to the path but I wasn't using the correct commands to run the conda environment. Therefore, all the keywords such as activate etc didn't work.
Simply type activate.bat and the file which is added to the path is opened which takes you to the base conda environment.
You can use this method to run different programs on different APIs and export the result back and analyse it.
Thanks for downvoting my question :)
I figured out how to do it, in my case with miniconda so it might be slightly different.
Find conda.exe in the Scripts folder. For me it was C:\Users\[SomeUser]\miniconda3\Scripts\conda.exe
Open command prompt and navigate to that same directory
Run conda init cmd.exe - To see more info on this command, you can run conda init --help, where it says "Initialize conda for shell interaction. [Experimental]"
Now after reloading command prompt, from anywhere you should be able to do conda activate WhateverEnvName and it will start it in that environment
If you want to make a batch file that opens to the environment, you can use cmd.exe /k conda activate WhateverEnvName
Alternatively, if you don't want to just open the environment, but actually want to launch a python script directly using that environment, you can type the full path to the python.exe in that environment folder, and then the relative path of the python script to run with that environment.
For example, say you open the command prompt in some arbitrary directory that contains "myscript.py" that you want to run with an environment called "whateverEnv".
You'd do: C:\Users\SomeUserName\miniconda3\envs\whateverEnv\python.exe myscript.py
You could also put that same line into a batch file.

Using python with Anaconda in Windows

I have just installed Anaconda on my computer because I need to use Numpy.
Well, when I use python I for some reason have to be in the same folder as python.exe and, of course, now that I want to use Anaconda I have to be in the Anaconda3\Scripts folder where python.exe isn't. This is a nightmare, how can I use anaconda with python on a windows computer? Why does it have to be so complicated?
I think you are referring to the command-line use of python?
If you have admin priviliges on your machine you can add python to your environment variables, making it available in the console anywhere. (Sorry for different spellings, I am not on an english machine)
Press Shift+Pause ("System")
Click "Advanced System Options"
Click "Environment variables"
In the lower field with "System variables" there is a variable called PATH. Append the complete path to your python.exe without the file to that by adding a ; behind the last path in the variable and then adding your path. Do not add any spaces!
Example: C:\examplepath\;C:\Python27\
When you install anaconda on windows now, it doesn't automatically add Python or Conda to your path.
If you don’t know where your conda and/or python is, you type the following commands into your anaconda prompt (it comes when you install anaconda)
Next, you can add Python and Conda to your path by using the setx command in your command prompt.
Next close that command prompt and open a new one. You should now be able to use the python command. To do this you open a command prompt and type
python nameofPythonfile.py
Source: https://medium.com/#GalarnykMichael/install-python-on-windows-anaconda-c63c7c3d1444
To be able to do that in the command line you just have to add Python and also the Anaconda3\Scripts directory to your system path.
Here is a good tutorial on setting your path in Windows:
http://www.computerhope.com/issues/ch000549.htm

Categories

Resources