Mac 下配置 Python 开发环境
2016-03-08 20:26
886 查看
➜ ~ sudo brew install python3 ==> Downloading https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz Already downloaded: /Library/Caches/Homebrew/python3-3.5.1.tar.xz ==> Downloading https://bugs.python.org/file40478/xcode-stubs.diff Already downloaded: /Library/Caches/Homebrew/python3--patch-029cc0dc72b1bcf4ddc5f913cc4a3fd970378073c6355921891f041aca2f8b12.diff ==> Patching patching file Lib/distutils/ccompiler.py patching file Lib/distutils/unixccompiler.py ==> ./configure --prefix=/usr/local/Cellar/python3/3.5.1 --enable-ipv6 --dataroo ==> make ==> make install PYTHONAPPSDIR=/usr/local/Cellar/python3/3.5.1 ==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python3/3.5.1/sh ==> Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools- Already downloaded: /Library/Caches/Homebrew/python3--setuptools-18.3.1.tar.gz ==> Downloading https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz Already downloaded: /Library/Caches/Homebrew/python3--pip-7.1.2.tar.gz ==> Downloading https://pypi.python.org/packages/source/w/wheel/wheel-0.26.0.tar Already downloaded: /Library/Caches/Homebrew/python3--wheel-0.26.0.tar.gz ==> /usr/local/Cellar/python3/3.5.1/bin/python3 -s setup.py --no-user-cfg instal ==> /usr/local/Cellar/python3/3.5.1/bin/python3 -s setup.py --no-user-cfg instal ==> /usr/local/Cellar/python3/3.5.1/bin/python3 -s setup.py --no-user-cfg instal ==> Caveats Pip and setuptools have been installed. To update them pip3 install --upgrade pip setuptools You can install Python packages with pip3 install <package> They will install into the site-package directory /usr/local/lib/python3.5/site-packages See: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Homebrew-and-Python.md .app bundles were installed. Run `brew linkapps python3` to symlink these to /Applications. ==> Summary 🍺 /usr/local/Cellar/python3/3.5.1: 7,619 files, 106.1M, built in 2 minutes 7 seconds ➜ ~
使用了几天sublimetext3,后面尝试了pycharm 秒杀一切 !!!
#import logging as logger import sqlalchemy import tushare as ts from sqlalchemy import create_engine # engine = create_engine('mysql://root:xxx@127.0.0.1/xxx?charset=utf8') # df = ts.get_tick_data('600848', date='2016-03-17') # df.to_sql('tick_data',engine,if_exists='replace') # engine = create_engine('postgresql://postgres:xxx@xxx.xxx.185.215:5432/xxx') # stocks.to_sql('tick_data',engine) # df = ts.get_tick_data('600848', date='2014-12-22') # engine = create_engine('mysql://xxx:xxx@xxx.xxx.185.215/xxx?charset=utf8') # https://github.com/PyMySQL/PyMySQL engine = create_engine('mysql+pymysql://xxx:xxx.@xxx.xxx.185.215/xxx?charset=utf8') # engine = create_engine('postgresql+pg8000://xxx:xxx@xxx.xxx.185.215:5432/xxx', client_encoding='utf8') # 追加数据到现有表 # df.to_sql('tick_data',engine,if_exists='append') #获得基本面数据 stocks=ts.get_stock_basics() # 存入数据库 stocks.to_sql('stock_basics', engine, if_exists='replace', dtype=dict(code=sqlalchemy.VARCHAR(length=10), name=sqlalchemy.VARCHAR(length=20), industry=sqlalchemy.VARCHAR(length=20), area=sqlalchemy.VARCHAR(length=10), pe=sqlalchemy.DECIMAL(18, 2), outstanding=sqlalchemy.DECIMAL(18, 2), totals=sqlalchemy.DECIMAL(18, 2), totalAssets=sqlalchemy.DECIMAL(18, 2), fixedAssets=sqlalchemy.DECIMAL(18, 2), reserved=sqlalchemy.DECIMAL(18, 2), reservedPerShare=sqlalchemy.DECIMAL(18, 2), eps=sqlalchemy.DECIMAL(18, 2), bvps=sqlalchemy.DECIMAL(18, 2), pb=sqlalchemy.DECIMAL(18, 2), timeToMarket=sqlalchemy.DECIMAL(18, 2))) #获取日k线数据 for code, row in stocks.iterrows(): his_data=ts.get_hist_data(code,start='2016-01-01',end='2016-03-19',retry_count=10) his_data['code']=code his_data.to_sql('his_data',engine, dtype=dict(code=sqlalchemy.VARCHAR(length=10),date= sqlalchemy.DATE()))
http://www.sublimetext.com/ https://packagecontrol.io/ http://www.jetbrains.com/pycharm/ http://python3-cookbook.readthedocs.org/ http://codingpy.com/books/thinkpython2/ http://scrapy-chs.readthedocs.org/zh_CN/latest/intro/tutorial.html http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000
相关文章推荐
- python中有关矩阵的创建、求逆、转置
- python tk模块的运用,检测JSON文件中是否有同类型控件的相同名称
- LIBSVM python
- python 压缩
- python脚本工具-1 制作爬虫下载网页图片
- ansible api python joke
- python第三方库系列之十九--python測试使用的mock库
- 基于Python的流式数据分析平台
- 【FastDFS分布式文件系统之二】:FastDFS小文件上传性能测试及Python客户端上传操作
- [Audio processing] 数据集生成 & 性别年龄分类训练 Python
- [转]Python os.path模块
- 学习python前需要了解的东西——————-python学习流程和资源
- PAT basic 1036 python
- Python变量作用域
- Python学习之:打印输出同一行
- 【零基础入门学习Python笔记001】我和Poyhon的第一次亲密接触:课后测试集答案
- Python Unicode and str
- python suds模块实现webservice客户端通讯
- 一个简单的爬虫程序
- python入门(三)