I can\'t install Python on my machine due to administrator privileges, but I did download/open Portable Python successfully. I am on a Windows 7 64-bit machine. How would I
For most external packages, I have been able to import them as follows:
.whl
file on PyPI into a custom 'include' folder on the disk/stick with Portable Python installed.
F:\py\include
-- whatever you choose, be sure the path to this folder has no spaces or special characters in it, or else Portable Python won't parse it correctly when added to PYTHONPATH
..whl
to .zip
and Windows Explorer will open it right up..whl
whose name is just the package name you're interested in: numpy
, sympy
, etc.PYTHONPATH
environment variable:
PYTHONPATH
. If it's there, select it and click 'Edit.' If not, click 'New'.PYTHONPATH
as the 'Variable name.' Either way, Add the path to your custom include folder into 'Variable value.' If other paths are already in there, separate your path from any prior one with a semicolon. DO NOT put a space between the semicolon and your new path! Portable Python apparently interprets entries with a leading space as being relative paths, with the reference folder being the Portable Python installation folder.In some cases where a "formal" installation process is required, this hasn't always worked. I think sympy
was one case where I had to compile it before transferring it to F:\py\include
. Also, I had a particularly rough time with h5py
, but eventually got it to work by installing it into a 'normal' version of Python 2.7 and copying the resultant h5py
folder over to F:\py\include
.
Do the following:
easy_install C:\temp\numpy-MKL-1.8.0.win32-py2.7.exe
(change the exe file name for whatever is the name of your installer).Test if the installation succeeded:
>>> import numpy
>>> print numpy.__version__
1.8.0
easy_install is trying to install from source. gmpy and gmpy2 are C extensions and require the presence of a compatible C compiler and other libraries (GMP; and MPFR and MPC for gmpy2). Installing from source is frequently difficult on Windows. The installers include a precompiled version of the extension.
One option is to extract the compiled binary from the installer. 7-Zip is able to open the installer file and you can extract the binary. In a standard Python installation, the extracted binary just needs to be placed in the site-packages directory. If necessary, you can do the extraction on another system and copy the file.
You can also use the zipfile module to extract the compiled extension. Here is an example. You will need to modify the exact file locations to reflect your system.
>>> import zipfile
>>> f=zipfile.ZipFile('gmpy2-2.0.0.win-amd64-py3.3.exe','r')
>>> f.namelist()
['PLATLIB/gmpy2-2.0.0-py3.3.egg-info', 'PLATLIB/gmpy2.pyd']
>>> f.extract('PLATLIB/gmpy2.pyd')
'C:\\Python33\\PLATLIB\\gmpy2.pyd'
please refer to https://groups.google.com/forum/?fromgroups#!topic/portablepython/BVQOHFNXilU
According to that, for most packages, you should be able to conduct an easy install into your Portable Python root folder and then import it as normal in your python script.