How to preload some libraries and scripts in python before I call python command? Is there something like .bashrc file to deal with predefining some functions/variables before launching a shell terminal?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create a file, ‘my_imports.py’ and add the import lines for all your modules.
Then set an environment variable ‘PYTHONSTARTUP’ and set it to ‘/path/to/my_imports.py’.
Now when you run python at the command prompt, it will load your modules first.