1

In Pythonxy I can edit some python scripts in an pre-defined folder so that they will be executed (or import? I don't know). For example, if I put a script in that folder:

import numpy as np
import scipy as sp

Then after I enter python shell, I can conveniently use np and sp as quick references.

Now the problem is, how can I use such technique without Pythonxy's support in standard python shell? Can I write a script to handle pre import? I think it will be very useful.

Hanky Panky
  • 46,730
  • 8
  • 72
  • 95
Warbean
  • 547
  • 2
  • 5
  • 19

1 Answers1

2

You can do this by setting up a python startup file, and set PYTHONSTARTUP variable to that file. In the startup file, just write

import numpy as np
import scipy as sp

Then, every time you enter python shell, it will automatically import the above modules.

Here is an example. Installing pythonstartup file

Community
  • 1
  • 1
RealityPC
  • 137
  • 8