git下载项目配置
git clone https://github.com/facebookresearch/llama-recipes
(到对应github项目自己指定)
下载依赖包(正常pip能自动下载)
pip install -r requirements.txt
pip uninstall requests
重装或清空pip
清空所有pip list
cd Desktop
pip freeze>all_modules.txt
pip uninstall -r all_modules.txt -y
pipenv虚拟/隔离python环境配置
D盘
pipenv虚拟环境目录设置_pipenv设置本地生成目录-CSDN博客
当前目录
【Python】—— pipenv虚拟环境创建目录修改为项目根目录下 + 自动更换pip源_windows设置pipenv虚拟环境为项目根目录-CSDN博客
删除环境变量为默认目录
可使用以下命令安装pipenv:
×(环境过大1.73G,建议配置到D盘)
√ 必须配置到C盘,因为官方会
FileNotFoundError: [Errno 2] No such file or directory:
'C:/.virtual_python/python3.10_ludwig-EUUnwRBF/lib/site-packages/ludwig/automl/defaults/base_automl_config.yaml'
pip3 install pipenv
pipenv --python 3.10
pipenv --python 3.8
激活
pipenv shell
pipenv install msvc-runtime matplotlib ludwig
pip install msvc-runtime matplotlib ludwig
(错误创建虚拟环境后,记得把文件删干净,
包括C盘的环境目录和当前目录下Pipfile Pipfile.lock)
完整
接下来,通过使用以下命令创建一个新环境,在指定目录下创建虚拟环境, 会使用本地默认版本的python:
pipenv install
如果要指定版本创建环境,可以使用如下命令:
pipenv --two # 使用当前系统中的Python2 创建环境
pipenv --three # 使用当前系统中的Python3 创建环境
pipenv --python 3 # 指定使用Python3创建环境
pipenv --python 3.6 # 指定使用Python3.6创建环境
pipenv --python 2.7.14 # 指定使用Python2.7.14创建环境
激活虚拟环境:
pipenv shell
删除虚拟环境:
pipenv --rm
使用exit()退出当前虚拟环境。
VS_code 加载虚拟环境
ctrl +Shift +P
指定为需要的虚拟环境
对ludwig官方文件修正
Lib\site-packages\ludwig\schema\metadata
下文件 __init__.py,更变26行
with open(os.path.join(_CONFIG_DIR, fname),encoding='utf-8') as f:
指定解码为utf-8
说明:该操作为yaml文件转换json等未知操作
yaml文件在格式上默认为
utf-8
utf-16
该文件未指定open的解码操作,即默认为GBK编码
导入ludwig包时,必须导入
import matplotlib.pyplot as plt
原因:
pip install msvc-runtime matplotlib
对matplotlib导入修补,意外修好了ludwig导入
import msvcrt为:
Microsoft Visual C++编程环境的一部分,
用于支持C++和C#等编程语言的应用程序运行时环境。
如果脱离依赖matplotlib,需要将msvcrt从临时环境变量变到环境变量
此外,对
from ludwig.automl import auto_train
报错
pip install dask ray hyperopt