Installing Python packages through pip? - python

I am trying to install the python package pyperclip.
I've been trying to do this for a while now, but it's simply not working. Here is what I've tried (from other answers on the internet):
Opened Windows Powershell, changed the directory to where I installed Python. The location of the file is below:
C:\Users\Jamie\AppData\Local\Programs\Python\Python37\Scripts
Entered the command pip install pyperclip. I get the following error message:
pip : The term 'pip' 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.
I also get the following suggestion from Powershell:
Suggestion [3,General]: The command pip was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\pip". See "get-help about_Command_Precedence" for more details.
Entered the command python -m pip install pyperclip. Here, nothing happens. I get no error message but I still can't import the package in Python IDLE.
I don't know what else to do? Any help is appreciated.
SOLVED: I ran the same command on cmd instead of PowerShell and it worked. Not sure why, though.

Related

Having trouble creating a virtualenv in Visual Studio

This might be a very basic problem but I can't seem to be able to install and name a virtualenv in VisualStudio.
Once I open up the terminal I enter
pip3 install virtualenv.
It then says it's been successfully installed but when I enter virtualenv env
it shows an error in the terminal stating The term 'virtualenv' 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.
So far I have tried uninstalling and installing the virtualenv but that hasn't seemed to work. I suspect that it might be an issue of the path but I'm not sure how to solve it. I have been trying to follow the first 5 minutes of this flask tutorial:https://www.youtube.com/watch?v=Z1RJmh_OqeA
Try running python3.9 -m virtualenv env. The error you are getting is because of issues with your path. (You can fix them but it's not mandatory, google "add python virtualenv to path" if you want)

How to create an executable with a pycharm python file though pyinstaller?

I have been trying to install pyinstaller in order to create an executable of a python project I have been working on, but my pip command simply doesn't work. This is the error I would get "'pip' is not recognized as an internal or external command, operable program or batch file". I have already checked the interpreter of my pycharm project, and it shows that it has pip already installed. I tried to look this up online, and I found out that a problem could be that the environment variable Path just needs to have the directory of my python version, but even after doing this, it still would not work. For additional information, I already tried to find the directory by using the command "where python" in the command prompt, but that path didn't work, and I'm using windows 10.
Usually for most of users, there would be a problem as you mention above. In such situation, you just need to install pip again with command like
python -m pip3 install -U pip
and remember next time, if pip reminds you to upgrade it, do not just use
pip install -U pip

PIP not present in Python 3.8 for Windows

I read in the PyPa pip documentation that pip comes with Python versions above 3.4 . Meanwhile when I run the 'pip help' command on my command prompt it gives me the message below:
'pip' is not recognized as an internal or external command,
operable program or batch file.
I tried executing a suggested command from a response to a similar question yielding this:
Looking in links: c:\Users\Public\Documents\Wondershare\CreatorTemp\tmpdgjv05zc
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-19.2.3 setuptools-41.2.0
I ran 'pip' help again yet again it gave me the same tone-deaf message
'pip' is not recognized as an internal or external command,
operable program or batch file.
I can run Python files and 'py --version' gives me the version of Python I'm using. I also tried placing the 'get-pip.py' file in a folder and getting to it through command prompt. Then I executed these commands
C:\Users\User\Desktop\pyt>python get-pip.py
C:\Users\User\Desktop\pyt>py get-pip.py
C:\Users\User\Desktop\pyt>python3 get-pip.py
They were executed immediately one-after-another but now no messages appear on the screen . Instead the OS goes to the next line, ignoring my command as if I didn't already execute one.
Why is it that I don't have pip installed? How can I install it?
Typically, when installing Python, if you add it to the PATH system environment variable, both the Python3x (containing the Python executable) and the Python3x\Scripts (containing pip) folders will be added to your path.
Apparently, something has happened to your path causing only the first of those two to be on the path.
Check which Python is on the path by running where python from the command line. If that's the version of Python you expect to be using, add the Scripts folder for the same version to the path as well.
Alternatively, uninstall your version of Python and then reinstall, ensuring you check it so it adds Python to the PATH - at the end of the Windows installation, there's the option to lift PATH length restrictions, which may be your issue.
Likely you didn't add your python installation to your path (here's a how-to guide if you've never done this before). If you are on windows then add %USERPROFILE%\AppData\Local\Programs\Python\Python38\Scripts\ to your path. Change the 38 to whichever point release you installed (so if you installed python 3.7 then it would be 37 etc.).

How to install requests module with pip? [duplicate]

This question already has answers here:
'pip' is not recognized as an internal or external command
(40 answers)
Closed 2 years ago.
I'm trying to install the requests module with pip, but I'm not sure if I'm doing it right. I open up the command prompt on windows(windows key+r,type in 'cmd' and hit enter). I have pip already installed, but when I type in 'pip install requests' to the command prompt it says
C:\Users\khern>pip install requests
'pip' is not recognized as an internal or external command,
operable program or batch file.
When I go check if pip is installed, this comes up
C:\Users\khern>python -m pip --version
'python' is not recognized as an internal or external command,
operable program or batch file.
So, then I go to add python's path to the environment variables changing the top part and the bottom part so hopefully the command prompt can run python programs. But when I go to the command prompt and type python, it still says
C:\Users\khern>python
'python' is not recognized as an internal or external command,
operable program or batch file.
Can someone tell me what I'm doing wrong? I'm new to programming, and just want to install the 'requests' module to finish the class I'm taking on python. Thanks!
visit this link:
https://datatofish.com/add-python-to-windows-path/
this will tell you how to add python to a path on windows so that you can access python from anywhere on the system.
if you need to use pip to install request:
python -m pip install requests
but before you run that command you have to make sure you are in pip folder,
which generally looks something like this:
c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip
The python path I think is not selected. Try reinstalling python and do this:
solve python path
or this:
solve python path
Check out this link:
'python' is not recognized as an internal or external command

How to install packages with pip in Windows PowerShell

I am using Python 2.7.9 on a Windows 8 computer.
I tried to install lxml by typing pip install lxmlin Windows PowerShell after typing python, but I get the following error: SyntaxError: invalid syntax
I tried installing pip by using the following tutorial http://www.tylerbutler.com/2012/05/how-to-install-python-pip-and-virtualenv-on-windows-with-powershell/ only to later realize that I already had pip.exe, pip2.7.exe and pip2.exe installed when I first installed Python. They are located in the C:\Python27\Scripts directory.
Yet, if I try something like pip help I will get an invalid syntax error.
Do I have to reinstall pip or how do I get it to work in order to install the lxml library.
Thank you for any help you can provide.
I had the same problem. You need to set the PATH environment variable, so that the system recognizes the command "pip".
If typing easy_install or pip [in PowerShell] doesn’t work, it means the Scripts folder is not in your path. Run the next command in that case (Note that this command must be run only once or your PATH will get longer and longer). Make sure to replace c:\Python33\Scripts with the correct location of your Python installation:
setx PATH "%PATH%;C:\Python33\Scripts"
Close and reopen PowerShell after running this command.
Source: http://arunrocks.com/guide-to-install-python-or-pip-on-windows/
Starting from Python versions 2.7.9 and 3.4.0, 'pip' is already included in the regular install. Check if the path to the 'Scripts' directory inside your Python installation directory is contained in your system's 'PATH' environment variable, so 'pip' can be found.
Look here for more information:
How do I install pip on Windows?
Edit: Sounds like you are trying to run pip inside python, You shouldn't get an 'invalid syntax' error through the command prompt. More like "'pip' is not recognized". Try simply just opening command prompt and typing 'pip help'

Categories

Resources