我正在使用setuptools尝试为python创建一个模块。
我尝试过本地安装和git with pip(版本3.5)。 pip表示已安装软件包,它已在已安装的软件包中列出“pip list”和“pip freeze”。当我尝试在我的脚本中导入模块时,我收到导入错误“ImportError:没有名为'jackedCodeTimerPY'的模块”。我一直在墙上敲我的头一段时间,我认为这是一个非常简单的问题,我只是遗漏了一些东西。
您可以在https://github.com/BebeSparkelSparkel/jackedCodeTimerPY
找到我的回购我的setup.py看起来像这样:
from setuptools import setup
setup(name='jackedCodeTimerPY',
version='0.0.0',
license='MIT',
description='Simple but powerful code timer that can measure execution time of one line, functions, imports and gives statistics (min/max/mean/total time, number of executions).',
author='William Rusnack',
author_email='williamrusnack@gmail.com',
url='https://github.com/BebeSparkelSparkel/jackedCodeTimerPY',
classifiers=['Development Status :: 2 - Pre-Alpha', 'Programming Language :: Python :: 3'],
py_modules=["jackedCodeTimerPY"],
install_requires=['tabulate==0.7.5'],
)
我的目录如下所示:
LICENSE.md jackedCodeTimerPY.py
README.md jackedCodeTimerPY.pyc
__pycache__ setup.py
build small.jpg
dist t2.py
example.py tests.py
jackedCodeTimerPY.egg-info
答案 0 :(得分:0)
似乎对我有用:
pip3 install git+git://github.com/BebeSparkelSparkel/jackedCodeTimerPY.git@master
Cloning git://github.com/BebeSparkelSparkel/jackedCodeTimerPY.git (to master) to /tmp/pip-lq07iup9-build
Collecting tabulate==0.7.5 (from jackedCodeTimerPY==0.0.0)
Downloading tabulate-0.7.5.tar.gz
Installing collected packages: tabulate, jackedCodeTimerPY
Running setup.py install for tabulate ... done
Running setup.py install for jackedCodeTimerPY ... done
Successfully installed jackedCodeTimerPY-0.0.0 tabulate-0.7.5
python3 -c 'from jackedCodeTimerPY import JackedTiming; print(JackedTiming)'
<class 'jackedCodeTimerPY.JackedTiming'>