问题
I am doing some Python 2.7 development work on multiple computers, on some of which I do not have rights to install software. Thus, I am using Portable Python. One of the packages I need to use is h5py; however, since Portable Python installs without modifying the registry, the h5py installer doesn't see it as a valid Python installation. Also, simply extracting the h5py source to a custom F:\py\include folder and adding F:\py\include to the PYTHONPATH environment variable doesn't work, as import h5py results in an ImportError: Cannot import name _errors exception.
How do I install h5py with Portable Python 2.7?
回答1:
- Install Python 2.7 onto a computer for which you have sufficient administrative rights.
- Install the appropriate version of
h5pyinto this Python installation. - Find the
h5pysubfolder within the Python install (typically.\Lib\site-packages\h5py) and copy it to theF:\py\includefolder mentioned (make sure to addF:\py\includetoPYTHONPATH). See my answer here for more details. - Uninstall the 'official' version of Python, if desired.
来源:https://stackoverflow.com/questions/30179534/how-can-i-install-h5py-with-portable-python-v2-7