Importing modules on portable python

后端 未结 2 437
星月不相逢
星月不相逢 2021-01-26 12:44

I am running PortablePython_1.1_py2.6.1 on a USB stick. My code relies on some modules that are not preinstalled. Does anyone know whether it is possible to add new modules to a

2条回答
  •  太阳男子
    2021-01-26 13:14

    What does import sys; print sys.path say? It should be the list of directories and zipfiles where Python (portable or otherwise) looks for modules to import. Just copy your modules into one of those directories or zipfiles, or sys.path.append('/whatever/dir') if you have your modules in /whatever/dir and want to keep them there (the latter approach will last only for the current session, be it interactive or a script's execution).

提交回复
热议问题