OpenAI ChatGPT-4开发笔记2024-01:开发环境

2024-01-08 06:40:30

ChatGPT发展一日千里。工具、函数少则数日,多则数月就加入了Deprecated行列不再如预期般工作。元旦闲来无事,用最新的ChatGPT重写一下各种开发场景,全部实测通过。

开发环境:

电脑:两台笔记本:HP和MacBookPro。
操作系统:主机Windows11上WSL+Ubuntu;MacOS
开发语言:Python 3.12.1
开发工具:Anaconda, miniConda,Jupyter, Visual Studio Code

1、MacBookPro:

先设置一下terminal

export PS1="%F{yellow}%n@%1~ %# %f%b"
export CLICOLOR=1
export LSCOLORS=ExGxBxDxCxEgEdxbxgxcxd
alias ll="ls -alG"

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew update
$ brew install pyenv 
$ brew cleanup pyenv
$ pyenv --version

2、HP笔记本

appstore安装wsl

C:\Users\ai>wsl -v
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.2861

appstore安装ubuntu

ai@HP11:~$ lsb_release -d
Description:    Ubuntu 22.04.3 LTS

Git自带。
彻底卸载自带的Python3.9。下载Python3.2.1.tgz,安装:

sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev liblzma-dev

export PYTHON_VERSION=3.12.1
export PYTHON_MAJOR=3

make clean
./configure \
    --prefix=/usr/bin/python3 \
    --enable-shared \
    --enable-optimizations \
    --enable-ipv6 \
    LDFLAGS=-Wl,-rpath=/opt/python/${PYTHON_VERSION}/lib,--disable-new-dtags

make
sudo make install

cd /opt/python/${PYTHON_VERSION}/bin
sudo ln -s python3.12.1 python
echo "PATH=/opt/python/3.12.1/bin/:$""PATH" >> ~/.profile
. ~/.profile

# List
hash -l 

# Delete a path in the hash table
hash -d python3

# Add a new path, which may be another version of python3
hash -p /usr/bin/python3 python3

# append below to .bash_profile
PATH=/usr/bin/python3/bin/:$PATH

安装openai:

apt get python3-pip
python3 -m pip install openai

安装Anaconda。Jupyter改浏览器。
都在这个文件里:
C:\Users\<your-username>\.jupyter\jupyter_notebook_config.py
如果不存在,这样建立一个:
jupyter notebook --generate-config
额,是个python文件。在这个文件夹里面加下面这行,再打开,browser改了。

#Opera 用这个
c.ServerApp.browser = '"C:\\Users\\aiai\\AppData\\Local\\Programs\\Opera\\launcher.exe" %s'
#chrome
c.ServerApp.browser = '"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" %s' 

启动目录同理,加这样一行:
c.LabServerApp.workspaces_dir = 'E:\\github'

总结

工欲善其事,必先利其器.
其他目的各种平台罗卜青菜,学习肯定要用JupyterLab,没有之一。
like in 100 years, intricate, highly detailed –ar 9:16 –chaos 25 –s 5000 –q 2

文章来源:https://blog.csdn.net/longwo888/article/details/113736129
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。