(1)报错:ModuleNotFoundError: No module named 'faiss.swigfaiss_avx2
# 进入python环境的faiss目录
cd your_python_path/site-packages/faiss
# 在git bash中打开
ln -s swigfaiss.py swigfaiss_avx2.py
(2)报错:line 6, in from streamlit.cli import main ModuleNotFoundError: No module named 'streamlit.cli
解决办法是,找到安装环境中的streamlit文件,打开,找到第6行,将 from streamlit.cli import main,改为from streamlit.web.cli import main 即可
# 在终端输入
streamlit hello
在结果中呈现下面内容,那么就成功了
👋 Welcome to Streamlit!
If you’d like to receive helpful onboarding emails, news, offers, promotions,
and the occasional swag, please enter your email address below. Otherwise,
leave this field blank.
(3)asyncio使用异常:This event loop is already running解决方式
asyncio是Python 3.4版本引入的标准库,直接内置了对异步IO的支持。最近我在多线程调用使用asyncio方法的时候,出现报错:This event loop is already running
asyncio不允许嵌套事件出现,需要引入nest_asyncio。
# 安装相关库
pip install nest_asyncio -i https://pypi.douban.com/simple
# 添加相关代码
import nest_asyncio
nest_asyncio.apply()
(4)ModuleNotFoundError: No module named ‘exceptions‘
解决方案如下:
pip uninstall docx
pip install python-docx
(5)ImportError: cannot import name COMMON_SAFE_ASCII_CHARACTERS‘ from charset-normalizerconstant‘
# 尝试以下命令更新模块
pip install --upgrade charset-normalizer
# 如果仍然无法解决问题,请尝试卸载charset_normalizer模块,然后重新安装
pip uninstall charset-normalizer
pip install charset-normalizer
(6)ValueError: Unknown encoding cl100k_base
相关链接:https://github.com/openai/tiktoken/issues/80
# Add the following to your pyinstaller prompt to make it executable:
--hidden-import=tiktoken_ext.openai_public --hidden-import=tiktoken_ext
(7)安装MMCV
官网安装说明:https://mmcv.readthedocs.io/zh-cn/latest/get_started/installation.html#pip
(8)windows Pyhton中安装jq的问题
国外大神自编译的 jq windows python 安装库,下载链接如下:
https://jeffreyknockel.com/jq/
(9)提示错误:ModuleNotFoundError: No module named ‘numpy.typing‘
pip install -U numpy
(10) AttributeError: 'Row' object has no attribute 'style' #693
pip install gradio==3.41.2
(11) AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`.
To avoid this error in existing code, use `float` by itself.
Doing this will not modify any behavior and is safe.
If you specifically wanted the numpy scalar type, use `np.float64` here.
pip install numpy==1.23.5
(12) 解决Anacoda新建环境或者升级conda update anaconda-navigator 报错问题
报错:cannot update anaconda navigator JSONDecodeError
试过的方法
(1)删除磁盘的.condarc
(2)pip install requests --upgrade
(3)conda clean --all
(4)conda update --all -y
(13)ImportError: cannot import name 'ValidationInfo' from 'pydantic'
https://github.com/deepinsight/insightface/issues/2563
pip uninstall pydantic
pip install --upgrade numpy
pip install pyre-extensions==0.0.29
pip install albumentations==1.4.3
pip install pydantic==1.10.13
pip uninstall albumentations pydantic
pip install albumentations pydantic==1.10.9