本文主要是介绍【anaconda 环境搭建】环境搭建python快速30分钟,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、下载anaconda
https://repo.anaconda.com/archive/index.html
选择下载 Anaconda3-2019.10-Linux-x86_64.sh
2、安装linux 工具4个,上传,下载,解压,打包
yum install zip
yum install unzip
yum install lrzsz
Yum install wget
3、rz Anaconda3-2019.10-Linux-x86_64.sh
4、安装 bash Anaconda3-2019.10-Linux-x86_64.sh
一直按回车,直到出现yes,按yes,然后继续按回车,默认安装路径,初始化提升 也按yes.然后就安装成功了。
修改~/.bashrc
export PATH=/root/anaconda3/bin:$PATH
source ~/.bashrc
5、接下来配置清华镜像源。
cd ~
mkdir ~/.pip
cd ~/.pip
vim pip.conf
写入如下内容:
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
换源成功。重新进入AI算法服务器
6、接下来 安装 python3.7.5环境以及安装依赖包,默认是3.7.4版本 ,这里我们需要安装python3.7.5
创建环境 conda create -n model python==3.7.5
激活环境 conda activate model
退出环境 conda deactivate
安装成功!
7、接下来进入python3.7.5环境,安装所需依赖包
先激活环境 conda activate model
进入model 环境之后,安装依赖包。用pip 命令安装即可。
pip install requests
pip install gunicorn==20.0.4
pip install uvicorn==0.11.3
pip install uvloop==0.14.0
pip install fastapi==0.52.0
pip install xgboost==0.90
pip install xlrd==1.2.0
pip install scikit-learn==0.22.1
pip install joblib==0.14.1
pip install pandas==0.25.3
pip install tensorflow==2.0.0
pip install keras==2.3.1
pip install lightgbm==2.3.1
pip install pillow==8.0.1
pip install opencv-python==4.4.0.46
pip install uuid
pip install kafka
pip install kafka_python
pip install pymysql
pip install psycopg2-binary
pip install apscheduler
8.也可以直接克隆 之前的虚拟环境。
conda env create -f model.yml
model.yml 内容如下:
name: model
channels:- defaults
dependencies:- _libgcc_mutex=0.1=main- ca-certificates=2022.3.29- certifi=2021.10.8- libedit=3.1.20210910- libffi=3.2.1- libgcc-ng=9.1.0- libstdcxx-ng=9.1.0- ncurses=6.3- openssl=1.1.1n- pip=21.2.2- python=3.7.5- readline=7.0- setuptools=61.2.0- sqlite=3.33.0- tk=8.6.11- wheel=0.37.1- xz=5.2.5- zlib=1.2.12- pip:- absl-py==1.0.0- apscheduler==3.9.1- astor==0.8.1- backports-zoneinfo==0.2.1- cached-property==1.5.2- cachetools==4.2.4- charset-normalizer==2.0.12- click==7.1.2- cython==0.29.32- dbutils==3.0.2- fastapi==0.52.0- gast==0.2.2- google-auth==1.35.0- google-auth-oauthlib==0.4.6- google-pasta==0.2.0- greenlet==1.1.2- grpcio==1.45.0- gunicorn==20.0.4- h11==0.9.0- h2==2.6.2- h5py==3.6.0- hpack==3.0.0- httptools==0.1.2- hyper==0.7.0- hyperframe==3.2.0- idna==3.3- importlib-metadata==4.11.3- joblib==0.14.1- kafka==1.3.5- kafka-python==2.0.2- keras==2.3.1- keras-applications==1.0.8- keras-preprocessing==1.1.2- ksql==0.10.2- lightgbm==2.3.1- markdown==3.3.6- numpy==1.21.6- oauthlib==3.2.0- opencv-python==4.4.0.46- opt-einsum==3.3.0- pandas==0.25.3- pillow==8.0.1- protobuf==3.20.1- psycopg2-binary==2.9.3- pyasn1==0.4.8- pyasn1-modules==0.2.8- pydantic==1.9.0- pymysql==1.0.2- python-dateutil==2.8.2- pytz==2022.1- pytz-deprecation-shim==0.1.0.post0- pyyaml==6.0- requests==2.27.1- requests-oauthlib==1.3.1- rsa==4.8- scikit-learn==0.22.1- scipy==1.7.3- six==1.16.0- sqlalchemy==1.4.39- starlette==0.13.2- tensorboard==2.0.2- tensorflow==2.0.0- tensorflow-estimator==2.0.1- termcolor==1.1.0- typing-extensions==4.2.0- tzdata==2022.1- tzlocal==4.2- urllib3==1.26.9- uuid==1.30- uvicorn==0.11.3- uvloop==0.14.0- websockets==8.1- werkzeug==2.1.1- wrapt==1.14.0- xgboost==0.90- xlrd==1.2.0- zipp==3.8.0
prefix: /root/anaconda3/envs/model
这篇关于【anaconda 环境搭建】环境搭建python快速30分钟的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!