Launch pycharm from cmd in windows - python

I can't be able to launch pycham (community version) from the cmd. I also set up the environment variable but still, I am getting this- 'pycharm-community' is not recognized as an internal or external command,
operable program or batch file.
I have used all these commands - charm, charm., pycharm., pycharm. But, I am getting the same problem.

For MS windows:
Find where your pycharm is installed
If it is installed in C:\Program Files\JetBrains\PyCharm\
Type this in cmd:
setx PATH=%PATH%;C:\Program Files\JetBrains\PyCharm\bin
if not, then replace the path to where you pycharm is installed
setx PATH=%PATH%;C:\Path\to\your\pycharm\bin
If this doesn't work, try to restart you system once.
To start pycharm using command, first see what is the file name for executable for pycharm inside the bin folder and use that name. It can be pycharm.exe or something similar.
If it is pycharm.exe, use 'pycharm' in cmd to start it.

Related

How do you open Jupyter Notebook without Anaconda and from any directory?

I need help opening Python using the command line from other folders. Currently, I can only open Jupyter Notebook via the command line in the directory that Python was installed in. The following commands worked:
python -m jupyter notebook
or
python -m notebook
Excluding python -m or -m results in an error.
When trying to access python from any other folders using the same commands, I get the following error:
'python' is not recognized as an internal or external command,
operable program or batch file.
A similar error is thrown when I use jupyter notebook or notebook.
I have downloaded Python and have used it using IDLE. I also installed Jupyter Notebook using pip; I did this by accessing Windows Powershell in the folder where Python is located.
Would appreciate it also if someone could explain what was happening and what I could do in the future to avoid this. Thank you for the help!
Python is not recognised outside its own folder (as you mention). To 'expose' the Python command to the console, you can add it to your Windows environment variables, as per the Python documentation.
To permanently modify the default environment variables, click Start and search for ‘edit environment variables’, or open System properties, Advanced system settings and click the Environment Variables button. In this dialog, you can add or modify User and System variables. To change System variables, you need non-restricted access to your machine (i.e. Administrator rights).
Concretely, in the environment variables of your system, edit the 'PATH' variable and add the folder with your Python executable to the path. After restarting your command prompt you should now be able to execute python commands.
While installing the Python, you can choose to add Python to PATH, if you check this while installing, you will have environment PATH variable in the machine.
Then you can just install notebook as you install any other packages/libraries in python.
pip install notebook
Once you do that, you should be able to start notebook from any folder/directory in your machine.
the command is pretty simple.
jupyter notebook

Visual Studio Code - Code Runner : 'python' is not recognized as an internal or external command, operable program or batch file

I have installed Visual Studio Code (VSC) and Code Runner.
When I use the terminal to execute my code it works fine and I get the results in the terminal window:
However, when I try to use Code Runner's keyboard shortcut Ctrl+Alt+NI keep getting this error message:
Which baffles me because VSC shows this:
I've tried rebooting (solution on another related SO question), creating a new conda environment inside VSC along with what seemed to be relevant from the VSC documentation here and here.
If anyone can help me understand what I need to be doing differently I would appreciate it.
You need to set a symbolic link between calling Python3 and Python since they're effectively the same thing. If you go into a normal command prompt / terminal and type Python3, you may get the same error. Whereas, if you type Python, it will launch the Python interpreter.
Close VSCode
If you're a Windows user you can use mklink to sort it out — open a Command Prompt as an Administrator, then navigate to your Python installation. e.g.:
cd C:\Python38
mklink python3.exe python.exe
In Linux, you can set a Symbolic link:
cd /usr/bin/python3
ln -s python.exe python3.exe
Startup VSCode again and it should work.

Unable to activate Conda environment as 'chcp' and 'cmd' is not recognized as internal or external command operable program

I am currently on the newest Anaconda3-5.0.1, Python 3.6 and using
Windows 8 (during the Anaconda installation I ticked the add to PATH
option). On Anaconda Prompt, I created a new conda env and Anaconda
tells me to activate it with
activate newenv
However, this error code pops up
'chcp' is not recognized as an internal or external command, operable program or batch file
'cmd' is not recognized as an internal or external command, operable program or batch file
'cmd' is not recognized as an internal or external command, operable program or batch file
Any ideas? I have tried this on Anaconda Prompt
set PATH=C:\Users\WIN8.1\Anaconda3\envs\newenv\Scripts;C:\Users\WIN8.1\Anaconda3\envs\newenv;%PATH%
However this is still unsuccessful as when i checked
conda info --envs
I can see the environment newenv I just created on the list, but the * sign is still next to root. The individual paths are also set correctly but not until the Scripts folder.
Would really appreciate help. Thanks so much guys.
I think first you should add the PATH where 'cmd' and 'chcp' located to the environment. (usually in C:\Windows\System32, you should check it out first)
Then add the path, go to:
Control Panel -> Advanced System settings -> Environment Variables ->
Path -> Edit
=====> Then add "C:\Windows\System32\" or "%SystemRoot%\System32;%SystemRoot%"
It worked for the others but actually this didnt work for me, then I run the command as
cd C:\Windows\System32
activate [environment name]
(it means that I have to activate the environment where 'cmd' and 'chcp' located . It's weird, but it worked for me.)
Hope it helps.
In my case, I changed the values order for Path System variable - now I have C:\Windows\System32 set as the first value. I have also added C:\Windows\System32 in the Path user variable.
I had the problem but for installing matplotlib.
I changed my environment variable with C:\windows\system32, closed the Anaconda prompt and reopened as administrator. Executing the command as administrator made it work.
Here are some links which helped my researches :
ContinuumIO
Chinese Forum

PyCharm cannot call programs from CMD Path

I have a code that needs to call a program from with a CMD command.
When I run the code in Python IDLE, it works, but not on Pycharm.
Here is an example code:
import os
os.system('pip')
This code runs on python IDLE, but on Pycharm it exits with:
'pip' is not recognized as an internal or external command,
operable program or batch file.
I am running it on Windows Server 2012 R2 if that helps.
How can I solve this? Thanks!
#Litwos,
pip should be bundled with your python interpreter - if PyCharm can find your python interpreter, it should be able to find a workable pip. Check that your python interpreter is set properly and PyCharm can find all the bundled tools.
Note: I have to do this for every new project:
Open PyCharm Preferences -> Project -> Project Interpreter
Select an appropriate interpreter
Verify that pip shows in the package list below the Project Interpreter listbox

error in creating http server on windows

I want to set up Python SimpleHTTPServer on windows XP. I have Python installed on my computer. I am executing the following command:
python -m SimpleHTTPServer 8888
But I am getting the error:
python :
The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Looks like Python is not in your PATH enviroment variable. To fix this try this answer:
https://stackoverflow.com/a/6318188/6400392
Hold Win and press Pause.
Click Advanced System Settings.
Click Environment Variables.
Append ;C:\python27 to the Path variable.
Restart Command Prompt.

Categories