Changing the directory where .pyc files are created

Yes, starting from Python 3.8 you can control this behavior. The original discussion starts from pep 304 in 2003. While this original PEP was withdrawn, a variant of this feature was eventually implemented for Python 3.8 in https://bugs.python.org/issue33499 In the result, you can control using PYTHONPYCACHEPREFIX=path, -X pycache_prefix=path and sys.pycache_prefix.

What are the limitations of distributing .pyc files?

For example, would a file generated with Python 3.1.5 be compatible with Python 3.2.x? No. Or would a .pyc file generated with Python 2.7.3 be compatible with a Python 3.x release? Doubly no. I’m considering distributing just the .pyc files without their corresponding .py sources. Python bytecode is high-level and trivially decompilable.