cs107-lecture-examples

Example codes used during Harvard CS107 lectures
git clone https://git.0xfab.ch/cs107-lecture-examples.git
Log | Files | Refs | README | LICENSE

README.md (1031B)


      1 # Setting up `PYTHONPATH` to point into custom Python code
      2 
      3 You can use the `PYTHONPATH` environment variable to let the Python interpreter
      4 know where to look for packages.  This is useful when you develop in order to
      5 avoid installation cycles of your packages if you only want to test.
      6 
      7 We have a CS107/AC207 test project called `cs107_package` in the parent
      8 directory of this current directory.  When we are in the Python interpreter a
      9 statement like `import cs107_package as cp` would fail because its location is
     10 not in the search path of the interpreter.
     11 
     12 You can solve this by adding the path to the Python package into the
     13 `PYTHONPATH` environment variable.  See the `setup_pythonpath.sh` shell script
     14 in this directory.  You can simply source it to add the new path.
     15 
     16 ```bash
     17 source setup_pythonpath.sh
     18 ```
     19 
     20 **NOTE:** you should avoid adding relative paths to environment variables like
     21 `PATH` or `PYTHONPATH` as it will break you setup.  It is done here because it
     22 will be easier for you to just test this out of the box.