Having trouble creating a virtualenv in Visual Studio - python

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)

Related

pip is installed in pycharm but cant able to run pip commands

Inside my pycharm package section pip (v:21.3.1) is showing as installed but when running pip commands it shows following error
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.
use !pip that might help. Else, try to see pip list and uninstall the package and try uninstalling using '!pip', this takes directly outside the main terminal.
My guess is that you are not inside the Pycharm virtual environment.
Try to go to the terminal/command line and go to the project directory,
you should look for 'venv' directory.
Than activate the virtual enviorment.
terminal:
source /venv/Scripts/activate (run activate.sh file)
command line
call /venv/Scripts/activate (run activate.bat file)
and then you will be able to run pip
Solution 1:
Install packages within pycharm & run the code within pycharm
Solution 2:
Find python.exe in the install directonary, open cmd in the folder and run following:
python.exe -m pip install ...
Solution 3:
activate the venv (you can find instructions on google or use the one from the dude above)
This might help
python -m pip install <package name>
Different solutions to this problem:
First: you are not on the pycharm terminal but on the power-shell terminal
(if so, use the drop-down menu to the right of the +)
edit: if you opened the file/folder without creating a project, pip won't work in it (using a virtual env anyway)
Second : you have a python3 environment
(use pip3 instead)
Last : your path is badly configured (not a big problem, passing by python -m pip ... it will work (or python3 or other version installed))
Finally, except in very specific cases
file->setting->python Interpreter allows you to install anything you want without command line
Hoping to have helped you ;}

Installing Python packages through pip?

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.

pip is not recognized what trying to install pyinstaller

Whenever I try to install pyinstaller I am not able to and I get the error "'pip' is not recognized as an internal or external command,
operable program or batch file."
could anyone help me as it also affects me when I try to install directories.
Try to use full syntax to command, typing:
python -m pip install pyinstaller
If you haven't installed pip, you can install it by using get-pip.py. Download it as a .py file, and run it using python get-pip.py.
To add it to your path variable so that you can run it from anywhere (assuming Windows 10), go to System/Control Panel, then Advanced System Settings, then Environment Variables. Find the path variable, and add at the end C:\Python27\Scripts\pip.exe (replacing XX with the appropriate Python version, and making sure that there's a semicolon between the end of the last entry and the new one). Save your changes, and you should be able to use pip from any directory in the system.

I can't use pip (Windows)

I'm wanting to learn machine learning, but it requires that I use 'pip.' I'm still very new to a lot of this stuff. I've installed Python 3.4 64-bit and get-py.py.
When I run pip install sklearn I get 'pip' is not recognized as an internal or external command, operable program or batch file.
Here's a screenshot of my environmental variable PATH
https://gyazo.com/c7ec926401878845d5c4f9a556cf00ee
Any help would be greatly appreciated. I have checked out other posts where people had similar issues, but I tried various things and nothing worked.
Easiest solution is to just download a platform like Anaconda for example. It is Python with many libraries (sklearn, pandas, numpy, ...) and also with pip, all in a user-friendly Windows installer package, that takes care of everything for you.
https://www.continuum.io/downloads
If you really want to do it yourself, then
download get-pip.py (https://bootstrap.pypa.io/get-pip.py)
make sure you have Python installed and in your PATH, for example by running python --version in command prompt
Navigate to the directory, where you downloaded get-pip.py (in command prompt using the command cd).
Run the command python get-pip.py from a command prompt with admin privileges (possibly not needed, but just to make sure).
This should be all. Close your command prompt, open it again and run pip --version to test it. If it doesn't work, then search your computer for a file named pip.exe (most likely in your Python directory) and if you find it, add its path to your PATH variable (given the screenshot, I assume you know how to do this).
I downloaded Python 3.6 and the pip was installed on my system.
I found pip at below location:
C:\Users\Admin\AppData\Local\Programs\Python\Python36\Scripts
Also, before I found pip I used below command on my command prompt to install pyperclip:
python -m pip install pyperclip
For anyone that might have installed Python using the MSI installer, and ticked the box to include pip, but still gets the error 'pip' is not recognized as an internal or external command, operable program or batch file:
It looks like that the pip executable is installed in the \Scripts subdirectory of the Python installation, but that directory does not get automatically added to PATH.
For me, since I had installed Python 2.7, the directory was C:\Python27\Scripts. After adding this path to the PATH environment variable, and open a new CMD window, pip was available as a command.
I've made a workaround that will help you, copy the batch script below and modify it as specified:
#"PATH to python.exe" "PATH to pip.exe" %*
For example like this:
#"C:\programming\bin\python374\python.exe" "C:\programming\bin\python374\Scripts\pip.exe" %*
Save this file as pip.bat on Desktop and then move it to C:\Windows\system32.
For Python 3.7 or higher at least (as today is October 4th 2019) in the installation window you need to check the box "add to PATH" when you first install Python.
I'm late now, but just add python to your environment variables.
It´s explained in this short video, how to set up python to your environment variables:
https://www.youtube.com/watch?v=Y2q_b4ugPWk
after that pip should work on your cmd prompt, without cd to
"C:\Users\Admin\AppData\Local\Programs\Python\Python36\Scripts"
This is late but in case anyone runs across this issue, pip installed for me as "pip3". Once I used pip3 as my command and not pip, it worked fine. Threw me for quite a loop since I've been using Python for years.
PIP Install and Upgrade
Ensure you are accessing the right location while accessing pip as shown in my link above. Starting Python 3.4, it is included by default with the Python binary installers.
Environment Variable
It is also a good idea to update the environment variable if the path is not accessible by default, once the installation is complete.
If it is specifically pip you want you could install python again making sure to tick the install pip box which it sounds like you failed to upon initial installation.

cannot get pip to be recognized as a command

I am trying to install matplotlib into python27 but am running into issues with pip. As stated when I try any 'pip' command I get
'pip' is not recognized as an internal or external command.
I checked my path variables and they point to the location of my OSGeo4W Python27 install. get-pip.py works and it even says I am up to date on my pip install.
I am wondering if the issue is that I have more than one Python installed on my PC. Arc Desktop decided I needed C:\Python27 and C:\Python34 on top of the OSGeo4W install in the C:\OSGeo4W64\apps\Python27
Anyone know what the issue might be?
Can I consolidate my python installs without breaking anything?
You need to add C:\Python27\Scripts to your path as well. That is where the pip executable lives by default.
Also, remember to close and reopen your command shell after you change your path variable to make sure that the update is loaded.

Categories

Resources