Mac 下配置 Python 开发环境
➜ ~ 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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· [AI/GPT/综述] AI Agent的设计模式综述
2013-03-08 ASP.NET中的COOKIE