Import modules to portable python

I am running PortablePython_1.1_py2.6.1 on a USB drive. My code depends on some modules that have not been pre-installed. Does anyone know if it is possible to add new modules to a portable python installation? Just copying to folders in site-lib doesn't seem to work.

+4
source share
2 answers

What import sys; print sys.path says import sys; print sys.path import sys; print sys.path ? This should be a list of directories and zip files, where Python (portable or otherwise) looks for modules to import. Just copy your modules into one of these directories or zip files or sys.path.append('/whatever/dir') if you have your modules in /whatever/dir and you want to save them there (the last approach will only last for the current session, whether interactive or script execution).

+6
source

This close-ended question was actually asked for Portable Python 3.2. I found a good way to install modules with Windows:

  • download zip archive redistribute module

  • install it by typing

    MyPythonPath \ App \ python Installing MyDownloadPath \ setup.py

to the DOS team

  • Easy Install is now installed in the MyPythonPath \ App \ Scripts folder. Enter a type, for example.

    MyPythonPath \ App \ Scripts \ easy_install-3.2 numpy

to install the numpy module.

+6
source

Source: https://habr.com/ru/post/1308489/


All Articles