人工智能环境搭建-ubantu python3.10.8安装记录

当前时间(2022-11)python3.11已经出来,python3.10已稳定

 

配置一个AI开发的python环境,代码部署迁移时,安装环境也一块带走

OS:ubantu20.10

安装用户:xt,

 

 python环境

sqlite3

小不点数据库,这个不是必须的,但很多其他软件会依赖它,比如jupyter

wget https://www.sqlite.org/2022/sqlite-autoconf-3390400.tar.gz

tar -xvf sqlite-autoconf-3390400.tar.gz
cd sqlite-autoconf-3390400/
./configure -prefix=/source/aisty/app/sqlite3
make
make install


编译安装python

wget https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tar.xz

安装目录xt用户要有权限访问
vim setup.py
在下面这段的下一行添加’/usr/local/lib/sqlite3/include’,
sqlite_inc_paths = [ '/usr/include',
                             '/usr/include/sqlite',
                             '/usr/include/sqlite3',
                             '/usr/local/include',
                             '/usr/local/include/sqlite',
                             '/usr/local/include/sqlite3',
                             '/source/aisty/app/sqlite3/include',
                             ]

./configure --enable-optimizations prefix=/source/aisty/app/python3 --with-ssl
make && make install

需要注意:安装的python3目录中,有python3,pip3,但却没有python,pip,而python,pip更常用,添加几个软链接解决这个问题
ln -s /source/aisty/app/python3/bin/python3.10 /source/aisty/bin/python
ln -s /source/aisty/app/python3/bin/pip3 /source/aisty/bin/pip

ln -s /source/aisty/app/python3/bin/pip3 /source/aisty/app/python3/bin/pip

 

export PATH=/source/aisty/app/python3/bin:$PATH

export PATH=/source/aisty/bin:$PATH

. ./.bashrc

 

xt@u11:~$ which python
/source/aisty/bin/python
xt@u11:~$ python
Python 3.10.8 (main, Nov  2 2022, 10:34:17) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
xt@u11:~$ which pip
/source/aisty/bin/pip
xt@u11:~$ pip --version
pip 22.2.2 from /source/aisty/app/python3/lib/python3.10/site-packages/pip (python 3.10)

 

数据科学编辑器

sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

pip install jupyter

 

机器学习

安装sklearn的时间会自动安装numpy,scipy
pip install pandas
pip install sklearn
pip install sklearn_crfsuite
pip install chinese_calendar
pip install matplotlib
pip install pydotplus

深度学习
pip3 install torch torchvision torchaudio
import torch
torch.__version__

 

知识图谱
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.13.0+cu117.html
pip install torch-sparse -f https://data.pyg.org/whl/torch-1.13.0+1.13.0+cu117.html
pip install torch-geometric
pip install torch-cluster -f https://data.pyg.org/whl/torch-1.13.0+1.13.0+cu117.html
pip install torch-spline-conv -f https://data.pyg.org/whl/torch-1.13.0+1.13.0+cu117.html

接口服务
pip install requests
pip install Flask
pip install gevent

 

调用java

得提前安装好JDK(https://jdk.java.net/archive/),没有用到java就跳过此步

JDK11: https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz

这里安装JDK8,因此涉及的到的JAVA项目是用JDK8开发的,有些软件要求至少JDK11,可以再单独指定

export JAVA_HOME=/source/aisty/app/jdk1.8.0_231
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

tar -xvf JPype1-1.3.0.tar.gz
python setup.py install

 
数据库连接
pip install cx_Oracle
pip install pymysql==1.0.2
pip install sqlalchemy

 

大数据hive,ubantu与centos并不通用, 是不一样的包,各安各的,这里不再安装。

 

posted @ 2022-11-02 16:15  方诚  阅读(326)  评论(0编辑  收藏  举报