简体   繁体   中英

How can I execute this Python package?

I found this package of descent gradient optimization variants in python. I installed python interpreter but i don't know how i can run the package. I already tried to use windows cmd. Ididn't used python before ,thanks a lot for helping me.

py-optim github

The github repository lacks a setup.py . If you want to install it, add the following code with the name setup.py to the top-level folder of the repository on your device. Then add one __init__.py file to the folder ..\\PyOptim . The __init__.py can be totally empty. Try also to file an issue in the repo, stating that the setup.py is missing.

from setuptools import setup

setup(name='pyoptim',
      version='0.1',
      description='optimizerTool',
      url='https://github.com/schaul/py-optim',
      author='None',
      packages=['PyOptim',
                'PyOptim.algorithms',
                'PyOptim.benchmarks',
                'PyOptim.core',
                'PyOptim.external_libs'])

Afterwards, open a cmd in the top-level folder, and run

python setup.py install

This installs everything. You then can import everything.

Note: This is only a quick- setup.py. Please also add install-requeries and so on to install dependencies of the repo.

If you want the folders test and tools also to be installed, add an empty __init__.py file to these folders as well and add the names in the packages list in the setup.py .

EDIT: Use this fork of the repository were i added the missing files. Make sure you install python 2.x as this repo is not for 3.x .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM