I\'m having trouble with using \'requests\' module on my Mac. I use python34 and I installed \'requests\' module via pip. I can verify this via running installation again an
If you are using PyCharms CE (Community Edition), then click on:
File->Default Settings->Project Interpretor
See the + sign at the bottom, click on it. It will open another dialog with a host of modules available. Select your package (e.g. requests) and PyCharm will do the rest.
MD
In your pycharm terminal run pip/pip3 install package_name
If you go to pycharm
project interpreter -> clicked on one of the installed packages then hover -> you will see where pycharm
is installing the packages. This is where you are supposed to have your package installed.
Now if you did sudo -H pip3 install <package>
pip3 installs it to different directory which is /usr/local/lib/site-packages
since it is different directory from what pycharm
knows hence your package is not showing in pycharm
.
Solution: just install the package using pycharm
by going to File->Settings->Project->Project Interpreter -> click on (+) and search the package you want to install and just click ok.
-> you will be prompted package successfully installed and you will see it pycharm
.
Using dual python 2.7
and 3.4
with 2.7
as default, I've always used pip3 to install modules for the 3.4
interpreter, and pip
to install modules for the 2.7
interpreter.
Try this:
pip3 install requests
Pycharm is unable to recognize installed local modules, since python interpreter selected is wrong. It should be the one, where your pip packages are installed i.e. virtual environment.
I had installed packages via pip in Windows. In Pycharm, they were neither detected nor any other Python interpreter was being shown (only python 3.6 is installed on my system).
I restarted the IDE. Now I was able to see python interpreter created in my virtual environment. Select that python interpreter and all your packages will be shown and detected. Enjoy!
This issue arises when the package you're using was installed outside of the environment (Anaconda or virtualenv, for example). In order to have PyCharm recognize packages installed outside of your particular environment, execute the following steps:
Go to
Preferences
-> Project
-> Project Interpreter
-> 3 dots
-> Show All
->
Select relevant interpreter
-> click on tree icon Show paths for the selected interpreter
Now check what paths are available and add the path that points to the package installation directory outside of your environment to the interpreter paths.
To find a package location use:
$ pip show gym
Name: gym
Version: 0.13.0
Summary: The OpenAI Gym: A toolkit for developing and comparing your reinforcement learning agents.
Home-page: https://github.com/openai/gym
Author: OpenAI
Author-email: gym@openai.com
License: UNKNOWN
Location: /usr/local/lib/python3.7/site-packages
...
Add the path specified under Location to the interpreter paths, here
/usr/local/lib/python3.7/site-packages
Then, let indexing finish and perhaps additionally reopen your project.