I installed bottle on python3.4 with pip install. In terminal, when I do:
$ python3.4
>>>import bottle # shows no import error
>>>
but when I do it in PyCharm, it says "import bottle ImportError: No module named 'bottle'"
I installed bottle on python3.4 with pip install. In terminal, when I do:
$ python3.4
>>>import bottle # shows no import error
>>>
but when I do it in PyCharm, it says "import bottle ImportError: No module named 'bottle'"
in your PyCharm project:
+
button to install additional python modules+
button and pick "Create VirtualEnv" to create a new environment in which the modules you will install later on won't mess up your python installation system-wide. This is also useful is you want to test different versions of a same module.
Sep 26, 2014 at 23:50
In some cases no "No module ..." can appear even on local files. In such cases you just need to mark appropriate directories as "source directories":
The settings are changed for PyCharm 5+.
Go to File > Invalidate caches/restart and click Invalidate and Restart to apply changes and restart PyCharm.
I am using Ubuntu 16.04. For me, it was the incorrect interpreter, which was by default using the virtual interpreter from the project.
So, make sure you select the correct one, as the pip install will install the package to the system python interpreter.
In the case where you are able to import the module when using the CLI interpreter but not in PyCharm, make sure your project interpreter in PyCharm is set to an actual interpreter (eg. /usr/bin/python2.7) and not venv (~/PycharmProject/venv/...)
I had the same problem, I tried all fixes like installing from the project interpreter and installing from python console, nothing worked. What worked was just going to the project folder from the terminal and installing it from there.
python3.4
that you use from the terminal? Have you set up a virtualenv or venv or user site-packages orPYTHONPATH
?More…
, then click the same interpreter again in the list that pops up, then click the paths button (the fan-out icon that's rightmost of the 5 buttons on the bottom left), then you get a list of Interpreter Paths, where you can click the + button to add another one.PYTHONPATH
, that's often a sign that you're doing something that might be better done with avirtualenv
/venv
, and PyCharm has some pretty nice support for that, so… have you considered that first?