How to import packages into Pycharm using PIP?
Solution 1
I found someone else's answer that works for me:
You need to use
import pip
pip.main(['install','packagename'])
Which allows you to manually install packages through pip using Python code.
Solution 2
This is guide for installing the pip packages from Python Console in Pycharm IDE.
Do not forget to run Pycharm as administrator if you are using windows OS before installing the packages.
First of all import the pacakage of pip in python console.
import pip
The below command will upgrade the version of package setuptools.
pip.main(['install','--upgrade','setuptools'])
The below command will install the scikit-learn and numpy packages.
pip.main(['install','numpy','scikit-learn'])
The below command will uninstall the scikit-learn package.
pip.main(['uninstall','scikit-learn'])
Comments
-
TheSaint321 almost 2 years
I'm trying to install a package onto Pycharm using PIP. I am running Anacondas on a Pycharm IDE. I know that you use the project interpreter to install packages and I also know that the package should be located under PyPi but when I go to the project interpreter and click add package the package I'm trying to install doesn't appear under the list of available packages.
I know that you can install the package using PIP and I have PIP installed through Anaconda although I am unsure how to run a pip command through Pycharm. I've tried typing it into the cmd console and the python code and neither seems to have any effect...
The package I'm trying to install is: https://github.com/seatgeek/fuzzywuzzy.
The pip command to install it is:
pip install fuzzywuzzy
but I am unsure as to where I'm supposed to run that command.I'm fairly new at Python so any help would be much appreciated!
Thank you!
-
Giordano over 6 yearsThis is strange because i tried to install it and I found it in the package list. Is this the only one that you can't install or do you have the same problem with all packages?
-
TheSaint321 over 6 yearsOther packages are showing up for me. When I search for FuzzyWuzzy it doesn't show up... Is it possible I have PyPi installed incorrectly or something? I"m running Anaconda so I have a lot of packages pre-installed.
-
Giordano over 6 yearsIf you try to open a command line (not in pycharm) and try to run pip? is it work or not?
-
TheSaint321 over 6 yearsWhat do you mean a command line? You mean a non-pycharm version of python, the command prompt? etc.
-
TheSaint321 over 6 yearsAlso what command would I run to run pip?
-
Giordano over 6 yearsyes, open a command prompt and run "pip freeze" it's just to understand if pip it's correctly installed
-
TheSaint321 over 6 yearsSays: "'pip' is not recognized as an internal or external command, operable program or batch file."
-