使用 setuptools 创建包安装不正确
creating package with setuptools not installing properly
我正在使用 setuptools 尝试为 python 创建一个模块。
我已经尝试在本地安装以及使用 pip(版本 3.5)从 git 安装。 pip 表示该软件包已安装,并在已安装的软件包中以 "pip list" 和 "pip freeze" 列出。当我尝试在我的脚本中导入模块时,出现导入错误 "ImportError: No module named '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
似乎对我有用:
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'>
我正在使用 setuptools 尝试为 python 创建一个模块。
我已经尝试在本地安装以及使用 pip(版本 3.5)从 git 安装。 pip 表示该软件包已安装,并在已安装的软件包中以 "pip list" 和 "pip freeze" 列出。当我尝试在我的脚本中导入模块时,出现导入错误 "ImportError: No module named '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
似乎对我有用:
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'>