简体   繁体   中英

Not able to install a python git hub package

For a class, I need to be able to use this github library: https://github.com/matsselen/pyolab . I am struggling to download/install it in a way that actually works. I am using anaconda for this and commands I've tried include:

conda install pyolab

pip install pyolab

conda install source_code_file_path

pip install -e git+https://github.com/matsselen/pyolab#egg=pyolab

I've saved the source code into anaconda's 'pkgs' folder and in my root folder.

I really don't know much about creating packages but in my searching, I found that the issue might be that there is no setup.py file included in the code on github. I tried to build my own but I can't get that to work. Here is the code I have for that:

from setuptools import setup 

setup(name='pyolab',
version='master',
description='IOLab code'
author='mats selen'
packages=['pyolab']
)

Also, I am being required to use the python 2.7 version of the package instead of the newer python 3 version.

Can anyone help point me in the right direction to get this working?

No need to pip-install repository, any python scripts can be used directly from any regular files/dirs on file system.

Just clone the repository:

git clone https://github.com/matsselen/pyolab

and then use sys.path to specify location of library's scripts and import them:

import sys
sys.path.append('./pyolab/PyOLabCode/')
# all dirs from sys.path are scanned by Python when you do import
# and the first matched dir where the module is found is used
import commMethods   # importing a script ./pyolab/PyOLabCode/commMethods.py

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