Anaconda 安装和配置
Anaconda 安装和配置
1. Anaconda 安装
Anaconda说明及安装过程:Anaconda详细安装使用教程
Anaconda环境变量配置:配置环境变量
2. Anaconda和Pip源修改
- Anaconda源修改:打开Anaconda Prompt后,输入以下代码。
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes - Pip源修改:在本地User用户目录新建pip目录,然后新建pip.ini文件,编辑如下代码后保存。
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
3. Anaconda常用命令
3.1 模块迁移
- 将当前环境安装的所有模块信息导出到名为requirements.txt文件中,该文件存放在当前用户目录下。
pip freeze > requirements.txt
- 新环境中根据requirements.txt文件来安装模块。
pip install -r C:\Users\XXX\requirements.txt
3.2 环境创建、激活和退出
- 创建环境
conda create -n env_name package_name=version
- 激活环境
(base) C:\Users\Administrator>activate superset
(superset) C:\Users\Administrator>
- 列出环境
(base) C:\Users\Administrator>conda env list
# conda environments:
#
base * D:\ProSoftwares\Python\Anaconda3
python36 D:\ProSoftwares\Python\Anaconda3\envs\python36
superset D:\ProSoftwares\Python\Anaconda3\envs\superset - 退出环境
(superset) C:\Users\Administrator>conda deactivate (base) C:\Users\Administrator>
3.3 克隆环境
使用该方法,可以重命名环境:
(base) C:\Users\Administrator>conda create -n analysis --clone python36
然后删除原来的环境即可:
(base) C:\Users\Administrator>conda remove -n python36 --all
4. Anaconda安装superset环境(在线)
4.1 创建隔离环境
(base) C:\Users\Administrator>conda activate -n superset python==3.6
创建一个隔离环境,防止和其它环境的包发生冲突。
4.2 安装VC++需求文件
进入superset环境后,尝试用pip install superset命令直接安装,最后提示Failed to build superset python-geohash错误,缺少编译环境,并提示下载:
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
上述下载地址失效,使用VC++14.0安装教程进行安装。安装完成后,重新使用pip install superset命令安装superset,则可正常安装:
Successfully installed cchardet-2.1.4 et-xmlfile-1.0.1 ijson-2.3 jdcal-1.4.1 jsonlines-1.2.0 linear-tsv-1.1.0 openpyxl-2.4.11 pure-sasl-0.6.1 python-geohash-0.8.5 rfc3986-1.3.1 simplejson-3.16.0 sqlalchemy-utils-0.33.11 sqlparse-0.3.0 superset-0.28.1 tableschema-1.4.1 tabulator-1.20.0 thrift-0.11.0 thrift-sasl-0.3.0 unicodecsv-0.14.1 unidecode-1.0.23 xlrd-1.2.0
4.3 配置superset
- 创建superset管理员账号
(superset) C:\Users\Administrator>fabmanager create-admin --app superset
fabmanager is going to be deprecated in 2.2.X, you can use the same commands on the improved 'flask fab <command>'
Username [admin]: admin
User first name [admin]: Strive
User last name [user]: Py
Email [admin@fab.org]: strive@qq.com
Password:
Repeat for confirmation:
Was unable to import superset Error: cannot import name '_maybe_box_datetimelike'出现Was unable to import superset Error: cannot import name '_maybe_box_datetimelike'错误,原因是pandas版本(0.24.2)太高,卸载重装0.23.4版本:
pip uninstall pandas pip install pandas==0.23.4
再进行管理员账号创建:
(superset) C:\Users\Administrator>fabmanager create-admin --app superset
fabmanager is going to be deprecated in 2.2.X, you can use the same commands on the improved 'flask fab <command>'
Username [admin]: admin
User first name [admin]: Strive
User last name [user]: Py
Email [admin@fab.org]: strive@qq.com
Password:
Repeat for confirmation:
Recognized Database Authentications.
Admin User admin created. 初始化数据库需要使用python superset命令,该命令需要进入superset包的bin目录(D:\ProSoftwares\Python\Anaconda3\envs\superset\Lib\site-packages\superset\bin)下执行:
(superset) D:\ProSoftwares\Python\Anaconda3\envs\superset\Lib\site-packages\superset\bin>python superset
Usage: superset [OPTIONS] COMMAND [ARGS]... This is a management script for the superset application. Options:
--version Show the flask version
--help Show this message and exit. Commands:
db Perform database migrations.
export_dashboards Export dashboards to JSON
export_datasource_schema Export datasource YAML schema to stdout
export_datasources Export datasources to YAML
fab FAB flask group commands
flower Runs a Celery Flower web server Celery Flower...
import_dashboards Import dashboards from JSON
import_datasources Import datasources from YAML
init Inits the Superset application
load_examples Loads a set of Slices and Dashboards and a...
load_test_users Loads admin, alpha, and gamma user for...
refresh_druid Refresh druid datasources
run Runs a development server.
runserver Starts a Superset web server.
shell Runs a shell in the app context.
update_datasources_cache Refresh sqllab datasources cache
version Prints the current version number
worker Starts a Superset worker for async SQL query...- 使用python superset db upgrade命令更新数据库,出现sqlalchemy.exc.InvalidRequestError: Can't determine which FROM clause to join from, there are multiple FROMS which can join to this entity. Try adding an explicit ON clause to help resolve the ambiguity.错误,原因是sqlalchemy包版(1.3.3)本太高,卸载重装1.2.0版本,就可以成功进行数据库更新操作。
- 使用python superset load_examples命令加载样例模板。
- 使用python superset init命令初始化用户角色和权限。
- 使用python superset runserver 命令启动服务报错,原因是superset使用gunicorn作为应用程序服务器,而gunicorn不支持windows,命令行中添加-d,使用development web server运行。最终运行命令为:python superset runserver -d。
最后在浏览器中访问:localhost:8088就可以打开superset登录页面。
4.4 Superset数据库查询报错
因为superset是为Linux和Mac服务的,Windows下缺失某些系统依赖包,所以进行数据库查询时,会提示'Module 'signal' has no attribute 'SIGALRM',并且查询不到数据,解决办法是修改superset安装目录下的utils.py(D:\ProSoftwares\Python\Anaconda3\envs\superset\Lib\site-packages\superset\utils.py)文件中关于signal提示的代码。用文本编辑器打开utils.py,找到如下代码:
def __enter__(self):
try:
signal.signal(signal.SIGALRM, self.handle_timeout)
signal.alarm(self.seconds)
except ValueError as e:
logging.warning("timeout can't be used in the current context")
logging.exception(e) def __exit__(self, type, value, traceback):
try:
signal.alarm(0)
except ValueError as e:
logging.warning("timeout can't be used in the current context")
logging.exception(e)
然后将代码修改为:
def __enter__(self):
try:
# signal.signal(signal.SIGALRM, self.handle_timeout)
# signal.alarm(self.seconds)
pass
except ValueError as e:
logging.warning("timeout can't be used in the current context")
logging.exception(e) def __exit__(self, type, value, traceback):
try:
# signal.alarm(0)
pass
except ValueError as e:
logging.warning("timeout can't be used in the current context")
logging.exception(e)
然后刷新superset即可。
5 Anaconda安装Superset环境(离线)
由于在线安装出现的问题太多,所以采取离线手动安装的方式。
5.1 使用Pip安装依赖包
在Github源码中找到依赖包文件requirements.txt
然后使用Pip安装依赖包:
pip install -r C:\Users\XXX\requirements.txt
如果中途发生版本不匹配问题,修改对应包版本再继续安装即可。
5.2 使用Pip安装Superset离线包
在官网下载superset-0.34.0安装包
然后使用Pip安装superset包:
pip install C:\Users\XXX\apache-superset-0.34.0.tar.gz
5.3 配置Superset
基本参考在线安装,需要注意:
- 设置用户名时不能设置admin,会提示唯一字段重复的sql错误。
- 启动服务时,在bin目录内使用命令python superset run即可。
5.4 Superset数据库查询报错
因为superset是为Linux和Mac服务的,Windows下缺失某些系统依赖包,所以进行数据库查询时,会提示'Module 'signal' has no attribute 'SIGALRM',并且查询不到数据,解决办法是修改superset安装目录下的core.py(D:\Prosoftwares\Python\Anaconda3\envs\superset\Lib\site-packages\superset\utils\core.py)中关于signal提示的代码(579行),按照4.4修改后,重启服务即可。
6 参考资料
- win7+python3.6+word_cloud 安装出现Microsoft Visual C++ 14.0 is required
- Superset的安装配置及基础使用手册
- Superset创建管理员Pandas报错
Anaconda 安装和配置的更多相关文章
- 面向的phthon2+3 的场景,Anaconda 安装+环境配置+管理
standard procedure in pyCharm for creating environment when Anaconda installed Create a conda env vi ...
- Anaconda 安装后配置环境变量
Anaconda 安装后在 cmd 中运算 python 无效, 是环境变量没有生效.正常安装需要有三个,配置好就行. D:\xwapp\ProgramData\Anaconda3 D:\xwapp\ ...
- Anaconda安装及配置
简介 Anaconda(官方网站)指的是一个开源的Python发行版本,可以便捷获取包且对包能够进行管理,同时对环境可以统一管理的发行版本.Anaconda包含了conda.Python在内的超过18 ...
- Python科学计算的瑞士军刀——Anaconda 安装与配置
Introduce Python是一种强大的编程语言.其提供了非常多用于科学计算的模块,常见的包含numpy.scipy和matplotlib.要利用Python进行科学计算.就须要一一安装所需的模块 ...
- Pycharm+Anaconda安装及配置
Pycharm是一款功能非常强大的IDE,配合Anaconda使用会非常的方便. 在安装Pycharm之前,我们的电脑上已经安装了Anaconda. 我们从官网下载Pycharm社区版.(https: ...
- anaconda安装和配置和基本使用
conda是个商业化公司,所以没有授权不能随便建立其镜像.虽说说的是发邮件询问基本上就能够拿到授权,然而现实是国内的各大开源镜像站都拿不到. 这个事情最近有进展了. 清华大学的镜像源已经拿到授权了 ( ...
- 从零开始安装搭建win10与ubuntu20.04双系统开发环境——集安装、配置、软件、美化、常见问题等于一体的——超详细教程
目录 **前言 ** 关于系统安装配置与软件安装 一.Win10安装ubuntu20.04双系统 1.按照自己的需求分区 2.配置软件镜像源 软件包管理工具介绍 更换APT源--使用国内镜像 3.解决 ...
- Ubuntu环境下Anaconda安装TensorFlow并配置Jupyter远程访问
本文主要讲解在Ubuntu系统中,如何在Anaconda下安装TensorFlow以及配置Jupyter Notebook远程访问的过程. 在官方文档中提到,TensorFlow的安装主要有以下五种形 ...
- Windows中Anaconda,Tensorflow 和 Pycharm的安装和配置
Anaconda完全入门指南 https://www.jianshu.com/p/eaee1fadc1e9 [安装不要按此条链接进行] Windows中 Anacond ...
随机推荐
- jq 全选
$(".checkall").change(function(){ if($(this).is(":checked")){ $(".checkchil ...
- ActiveMQ入门之四--ActiveMQ持久化方式
消息持久性对于可靠消息传递来说应该是一种比较好的方法,有了消息持久化,即使发送者和接受者不是同时在线或者消息中心在发送者发送消息后宕机了,在消息中心重新启动后仍然可以将消息发送出去,如果把这种持久化和 ...
- HDU 4970 Killing Monsters(树状数组)
Killing Monsters Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Other ...
- temple-html5
ylbtech-HTML5: 1.返回顶部 2.返回顶部 3.返回顶部 4.返回顶部 5.返回顶部 6.返回顶部 7.返回顶部 8.返回顶部 9.返回顶部 1 ...
- Apache common exec包的相应使用总结
最近在写一个Java工具,其中调用了各种SHELL命令,使用了Runtime.getRuntime().exec(command);这个方法.但是在我调用某个命令执行操作时,程序就卡在那了,但是其 ...
- PyQt 5布局管理
绝对定位 绝对定位有以下限制 1.如果调整窗口,控件的大小和位置不会改变 2.在各种平台上应用程序看起来不会一样 3.如果改变字体,我们的应用程序的布局就会改变 4.如果我们决定改变我们的布局,我们必 ...
- [Oracle] 用python插入中文
先替换字符串中的\x22 为双引号,\x0A为回车 str2 = '{\x22name\x22:\x22hao\x22 \x0A ,\x22os\x22:\x22other\x22 } print s ...
- 01——微信小程序官方demo讲解——文件结构
1.环境概览 首先环境配置的部分略过,打开小程序开发工具.选择一个空目录,即可开始一个demo项目. 其中新建成功后的目录如图所示: 2.文件结构描述 如图所示,左边是界面展示,右边是目录结构. 目录 ...
- cocos2dx 3.6版本播放动画
IDE: VS2013 版本:cocos2dx 3.3.6 语言:c++ 11 3.x版本改动与2.x版本相比改动很大,几个比较明显的点就是所有带cc的前缀没有了,然后一些获取类型的函数名称加了get ...
- GIL与线程、进程、协程
GIL全局解释器锁: 1.相信大家都知道python代码是不能直接被机器cpu识别和执行的,它要经过python解释器(也就是我们执行时候的python3 name.py)被编译成机器语言,pytho ...