Just like when you install a pip module in bash you can use it straight away from the Terminal without needing to start python like a system command.
Is there a way to do the same thing in windows command prompt without it showing the error "command not found"?
Related
I am currently learning the basics of SpaCy, and need to install a pipeline package in order to use it. I use the Spyder IDE.
The command is:
$ python -m spacy download en_core_web_sm
However, I have no idea where I should paste this command in order to install the pipeline.
I have tried the command prompt in Spyder(on the righthand side), and I am always greeted with the message "invalid syntax"
I have also tried using this command on the anaconda command prompt, where the first character "$" is never recognised.
What should I do in order to succesfully install this pipeline package? Please and thank you!
I'm trying to run shell commands in the Jupyter notebook but it doesn't work
!which python
It shows an error
'which' is not recognized as an internal or external command,
operable program or batch file.
If you are working on windows based system:
!where python
Else:
%%bash
which python
References:
https://www.shellhacks.com/windows-which-equivalent-cmd-powershell/
https://stackoverflow.com/a/48529220/15488129
Can you run python3 --version. I am assuming you are using Windows. Open your command line and run the command too. If you still get the same response, it means you did not add python to path while installing. Did you install using Anaconda?
If you want to add python to path, just simply follow this link. It's self-explanatory. Let me know in the comment section if you still have issues.
https://datatofish.com/add-python-to-windows-path/
I use Spyder(anaconda3) to do much of my python work and I can use pip install directly from the spider console but not from windows 10 command prompt. Is there a way to PATH pip install from the spider/anaconda program to work directly with the command prompt?
Is this something that is strictly necessary or even useful to do, can the spider console handle all that is required (even non python instilations) without bothering with the windows comand prompt? For example if I were to run
pip install jupyterlab
from the spider console would this be an issue or would it make more sense to run it from the command prompt? (I know jupyterlab is included in annaconda I was just looking for an exapmle)
The only difference between running the Windows command shell from Spyder is that Spyder will automatically activate your conda environment. You can achive the same thing by running
conda activate
as the first command in your Windows cmd shell.
Alternatively you can start the cmd shell via the "Anaconda prompt" in the Windows Start Menu.
I am having a problem running my script in VSCode.
I have tried the following:
Reinstalling requests through pip, easy_install, and sudo pip
Importing requests directly in the Python interpreter (which worked)
This leads me to believe that VSCode isn't using the correct interpreter that actually has the package installed.
You can choose your interpreter in VS Code in several ways. One of them is by clicking the tab in the bottom toolbar (lower-left) which might say "Python 3.9.4 (64-bit)", upon which you will be able to select from a menu of choices, e.g. /usr/bin/python3 or a conda or brew installation, etc.
I think yours is python environment problem. To check whether it's python environment or not, you can use which python (or which python3 if you use python3) command in your both vscode terminal and mac terminal. If you see different python path, then your vscode is using different python environment. You can change the python interpreter in vscode to have same environment as your mac terminal.
Open Command Palette in vscode with ⇧⌘P
Type "Python: Select Interpreter"
Then, choose the same environment as your mac terminal (If you want the same one, you can choose the same python environment path as mac terminal that you get with "which python" or "which python3").
You may be able to find a solution here: ImportError: No module named requests
You haven't mentioned using different versions in your commands. It's possible you need to use pip3 instead of pip, or python3 instead of python.
I am very new to python and plan to use psychopy quite a lot. I am on a work computer but have full admin rights.
Psychopy came with python version 2.7.11 and includes setuptools already.
I am trying to install the selenium module, but having trouble getting pip to work at all.
In cmd, it is recognising the 'python' command, so I know python is in my path.
I get the message "can't open file 'pip': [Errno2] No such file or directory" from:
python pip install selenium
I get " 'pip' is not recognised as an internal or external command" from:
pip install selenium
When I change directory to where pip is located, I get:
Fatal error in launcher: Unable to create process using '"'
Using pip2 makes no difference.
It seems a simple thing but where am I going wrong with this?!
I never really got to the bottom of this, but this is what I found out and here are the commands that worked for me in Windows. Be aware that I am far from expert!
To run python scripts (*.py) from command line (cmd) then C:\PsychoPy2 and C:\PsychoPy2\DLLs need to be in path. ('Path' contains directories or file extensions that can be more globally accessed, i.e. do not require you to change the prompt to the relevant directories first).
To check, open cmd and either type echo %PATH% or just type python. (If python starts, the line will say >>>. You can exit by typing quit())
To add to path, get properties of computer, then advanced system settings, then environment variables.
To check pip.exe (a sort of installation wizard) is installed, either search for the file, or check C:\PsychoPy2\Scripts for it. This may also need to be in path.
To reinstall the latest versions of pip and setup tools, I went to cmd and typed:
python -m pip install -U pip setuptools
If the same code did not work for other modules (which in my case was due to network access), then I downloaded the wheel file (*.whl) for that module (from their website) and ran the following code:
python -m pip install c:/modulename.whl
These may not be the correct ways of doing things, but they worked for me when I couldn't get other ways to work!
I've just had the exact same issue with the pip install, and a conflict with PsychoPy installations. I think it's because python automatically wants to call on the path that's been set by Psychopy, so it can't get to the 'pip' folders that for me, remain in a temporary/hidden file. This wasn't intuitive for me - on any machine without psychopy python just 'works' when you download it.