Sidekit (i) Installation __h5py

Source: Internet
Author: User
Tags parse error virtual environment

Today, a sudden whim, just to use the sidekit, simply put the previous clean up the bar ——— –
Note: Sidekit does not support Python2 now. X, here's the python3.5 version.
If you do not have a python3 environment, or a version of the Python2 that was installed when you installed Annoconda, you can create a PY3 virtual environment that activates this Sidekit environment when you use PY3:
Like what:

Conda Create--name=py3 python=3.5
source Activate Py3

The first is to install in a more normal way:

# Sidekit used for h5py file storage, so this is a must
pip install h5py
# When installing to find the latest
pip install sidekit==1.2.3 
# in the installable version list If you need to do a local demo, install Pyaudio, otherwise do not need
if the Mac installed Pyaudio words, look at this:
http://blog.csdn.net/zjm750617105/article/details/72966002

If it goes well, the installation is over. If you have other questions, check out the following to see what you need.

Question 1:
This problem is encountered during PIP installation:

Collecting Sidekit
  Using cached sidekit-1.1.7.tar.gz
    Complete output from command python setup.py egg_info:
    Error in Sidekit Setup command: ' Install_requires ' must to be a string or list of strings containing valid Project/versi on requirement specifiers; Invalid requirement, parse error at "' =1.10.4 '"   
    ----------------------------------------
Command "python setup.py egg_info "failed with error code 1 in/tmp/pip-build-uql92uct/sidekit/

The workaround: Manually download sidekit-1.1.7.tar.gz and then sudo python3 setup.py install

Question 2:
Ubuntu Install Sidekit requirements pip version is 9.0.1, but can not be directly updated, can only go to the official online https://pypi.python.org/pypi/pip download. tar.gz Package (do not download WHL package, or prompt version error), sudo python3 setup.py Install
Question 3:
There are libsvm.so to install the error, to the official website under the latest, do not look at some Chinese blog (hit their own face Mody.) Pannima wrong.

Compile the library (libsvm.so.2 on Unix/linux and MAC platforms and Libsvm.dll on Windows) and
create a link or copy This library in./sidekit/libsvm/.

This is a sidekit document, after downloading LIBSVM, make it under LIBSVM, then go into Python, make it again, then go back to LIBSVM a libsvm.so.2, and then follow the words above.

Also some hint libsvm.so.3 what, also bothered one hours, this is under/usr/local/lib have libsvm.so.3, but from the official website of the latest compiled out is libsvm.so.2, don't know, Anyway, this error should be the above libsvm.so.2 not add to/usr/local/lib/python2.7/dist-packages/sidekit/libsvm/.

Every time the environment is all kinds of pits ...

Note: If you want to run the program need a variety of problems can not be solved, remember will python2 replaced Python3, everything is okay

H5py also has a lot of pits, the following content is fully referenced from: http://www.aichengxu.com/view/24309 determine the system has python,numpy,libhdf5-dev, and HDF5. The first three are generally. here to install HDF5; To HDF5 official website (http://www.hdfgroup.org/HDF5/) Download compiled bin (yes, although the tutorial to compile, here to the user is compiled a good bin, make me this small white compiled for half a day); Unpack, rename folder for Hdf5, move to/usr/local/hdf5 under
4. Add environment variable VIM. Bashrc:export hdf5_dir=/usr/local/hdf5, here HDF5 installed, only install good HDF5 can successfully install h5py pip install H5py
Too difficult, need to pip-9.0.1, go to the official website follow the instructions to install it, if 2.7 3.5 environment a bit messy, run PIP when remember the prefix path

Import h5py 
import numpy as np
data = Np.array ([222,333,444])

label = Np.array ([0,1,0])
img_num = Np.a Rray ([0,1,2])

#创建HDF5文件
file = h5py. File (' Trainset_rotate.h5 ', ' W ')
#写入
file.create_dataset (' train_set_x ', data = data)
File.create_ DataSet (' train_set_y ', data = label)
file.create_dataset (' train_set_num ', data = Img_num)
file.close ()
import h5py import NumPy as NP # Read mode opens the file file=h5py. File (' Trainset_rotate.h5 ', ' R ') # although there are ' [:] ', but the matrix is how to get out, will not be stretched (matlab sequelae) train_set_data = file[' train_set_x ' [ :] train_set_y = file[' train_set_y ' [:] train_set_img_num = file[' Train_set_img_num '] [:] File.close () 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.