2016-10-18 68 views
0

我正在使用setuptools嘗試爲python創建模塊。使用setuptools創建軟件包時未正確安裝

我已經嘗試在本地安裝,並從與GIP與PIP(版本3.5)。 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='[email protected]', 
     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

似乎爲我工作:

pip3 install git+git://github.com/BebeSparkelSparkel/[email protected] 

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'> 
+1

由w唉,看看['time.perf_counter()'](https://www.webucator.com/blog/2015/08/python-clocks-explained/)。 – wrwrwr

+0

感謝您的建議。這是更多的演示項目。現在其他地方一定有問題,因爲我以前一直在爲我安裝好。 –

+0

重新安裝pip,它現在似乎工作。 –

相關問題