Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Change default python library path (PYTHON_LIBRARY) doesn't work

I installed a few new python libraries under a directory in my project. (Python 3.8, in a conda environment)

cd c:\myproj\python-libs
pip install tornado-swagger -t .

And I tried to run it after setting PYTHON_LIBRARY

set PYTHON_LIBRARY=c:\myproj\python-libs
cd c:\myproj
python myproj.py

However, it got the error of ModuleNotFoundError?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Traceback (most recent call last):
  File "myproj.py", line 10, in <module>
    from tornado_swagger.setup import setup_swagger
ModuleNotFoundError: No module named 'tornado_swagger'

>Solution :

PYTHON_LIBRARY isn’t a standard environment variable examined by Python. If you want to change the module search path from the command line, you can set the PYTHONPATH environment variable:

set PYTHONPATH=c:\myproj\python-libs

Note that default search path is always appended to value given by PYTHONPATH, so modules found by searching PYTHONPATH will take precedence over those on the default search path (this doesn’t include builtin modules, however, which are always searched first).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading