简体   繁体   中英

Set paths for JetBrains PyCharm [Linux]

I run Python program which uses couple of source paths on runtime.

I put these rows on my /.bashrc file:

source home/raphael/kaldi/aspire/s5/cmd.sh
source home/raphael/kaldi/aspire/s5/path.sh

So when I'm running from terminal everything works fine and Python manage to locate paths.

However when I'm trying to run through PyCharm for DEBUG purposes mostly it seems that PyCharm can't locate the paths.

Is there anyway to add the paths manually for PyCharm or make it read /.bashrc file. What I am missing?

You can try using the options available in the Run/Debug Configuration settings (Run > Edit Configurations...)

You can set environment variables individually (such as $PATH), or at the bottom is a section to define external tools (scripts) to be run when your Python code is run or debugged. From that sub-section, you could set your bash scripts to be run each time you start debugging.

Alternatively, see if using os.environ would work for your project. Check the docs for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM