軟件包的安裝
-
pip的安裝
網(wǎng)頁地址:https://pypi.python.org/pypi/pip#downloads
-
pip安裝步驟:
- 下載[pip-8.0.2.tar.gz]顶霞,解壓到文件夾
- 命令行工具cd切換到pip的目錄,找到setup.py文件
- 運(yùn)行python setup.py install
- python的安裝路徑添加到環(huán)境變量path中蚂子,例如D:\Python27\Scripts
-
distribute的安裝
命令行:pip install distribute
-
nose的安裝
命令行:pip install nose
-
virtualenv的安裝
命令行:pip install virtualenv
創(chuàng)建骨架項(xiàng)目目錄
-
目錄結(jié)構(gòu):
project 文件夾
+ ####NAME 文件夾
+ #####\_\_init\_\_.py 文件
- ####bin 文件夾
- ####docs 文件夾
- ####tests文件夾
+ #####\_\_init\_\_.py 文件
- #####NAME_tests.py 文件
- ####setup.py文件
-
setup.py文件
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description' : 'My Project',
'author' : 'My Name',
'url' : 'URL to get it at.',
'download_url' : 'Where to download it.',
'author_email' : 'My email',
'version' : '0.1',
'install_requires' : ['nose'],
'packages' : ['NAME'],
'scripts' : [],
'name' : 'projectname'
}
setup(**config)
-
tests/NAME_tests.py文件
from nose.tools import *
import NAME
def setup():
print "SETUP!"
def teardown():
print "TEAR DOWN!"
def test_basic():
print "I RAN"
測試我的配置
Paste_Image.png