Skip to content

Commit f4e0e4a

Browse files
committed
Add PyCharm requirements issue to FAQ.
1 parent af0806d commit f4e0e4a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/faq.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,25 @@ You'll need to use an external tool to manage the framerate.
88
This can either be your own custom tool or you can copy the Clock class from the
99
`framerate.py <https://github.com/libtcod/python-tcod/blob/develop/examples/framerate.py>`_
1010
example.
11+
12+
I get ``No module named 'tcod'`` when I try to ``import tcod`` in PyCharm.
13+
--------------------------------------------------------------------------
14+
15+
`PyCharm`_ will automatically setup a `Python virtual environment <https://docs.python.org/3/tutorial/venv.html>`_ for new or added projects.
16+
By default this virtual environment is isolated and will ignore global Python packages installed from the standard terminal. **In this case you MUST install tcod inside of your per-project virtual environment.**
17+
18+
The recommended way to work with PyCharm is to add a ``requirements.txt`` file to the root of your PyCharm project with a `requirement specifier <https://pip.pypa.io/en/stable/cli/pip_install/#requirement-specifiers>`_ for `tcod`.
19+
This file should have the following:
20+
21+
.. code-block:: python
22+
23+
# requirements.txt
24+
# https://pip.pypa.io/en/stable/cli/pip_install/#requirements-file-format
25+
tcod
26+
27+
Once this file is saved to your projects root directory then PyCharm will detect it and ask if you want these requirements installed. Say yes and `tcod` will be installed to the `virtual environment`. Be sure to add more specifiers for any modules you're using other than `tcod`, such as `numpy`.
28+
29+
Alternatively you can open the `Terminal` tab in PyCharm and run ``pip install tcod`` there. This will install `tcod` to the currently open project.
30+
31+
32+
.. _PyCharm: https://www.jetbrains.com/pycharm/

0 commit comments

Comments
 (0)