
问题
记录工作中遇到的问题
wohu007
这个作者很懒,什么都没留下…
展开
-
hnswlib RuntimeError: Cannot return the results in a contigious 2D array. Probably ef or M is to sma
1. 问题现象index = hnswlib.Index(space = '100', dim = 512) index.init_index(max_elements = 100, ef_construction = 200, M = 16)# Insert this single entryindex.add_items(dd, np.asarray([10000]))index.set_ef(200)labels, distances = index.knn_query(dd, k原创 2020-05-14 22:43:25 · 2351 阅读 · 0 评论 -
sklearn FutureWarning: numpy not_equal will not check..., The comparison did not return the same
1. 问题import sklearn 后有如下警告ubuntu@test:/data/# pythonPython 2.7.12 (default, Nov 12 2018, 14:36:49)[GCC 5.4.0 20160609] on linux2Type "help", "copyright", "credits" or "license" for more informati...原创 2020-04-18 20:28:36 · 457 阅读 · 0 评论 -
pip install faiss-gpu失败unable to execute ‘swig‘: No such file or directory
1. 安装报错unable to execute 'swig': No such file or directoryerror: command 'swig' failed with exit status 12. 解决方法$ sudo apt-get install swig原创 2021-03-17 22:11:44 · 1524 阅读 · 0 评论 -
安装 sklearn 报错 ImportError: cannot import name Type
1. 安装 sklearnsudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple sklearn会默认安装 joblib , scipy , scikit-learn , sklearn 。2. 报错import sklearn 报错 ImportError: cannot import name 'Type'>>> import sklearnTraceback (most recent call last原创 2020-11-01 22:55:54 · 3240 阅读 · 0 评论 -
python2 安装faiss-gpu 报错 faiss/faiss/python/swigfaiss.i:241: Error: Unable to find ‘faiss/impl/platfo
1. 安装报错$ sudo pip install faiss-gpu --default-timeout=1000 -i https://pypi.douban.com/simpleDEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop su原创 2021-03-17 22:16:19 · 2011 阅读 · 2 评论 -
pip install nmslib 失败 (error: command ‘x86_64-linux-gnu-gcc‘ failed with exit status 1)
1. 问题现象使用 pip 安装 nmslib 命令时出现如下错误:sudo pip install nmslib....ERROR: Complete output from command /usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-OKEXAd/nmslib/s...原创 2019-05-28 21:13:51 · 2557 阅读 · 0 评论 -
SSLError: (‘The read operation timed out‘,) 解决方法
SSLError 问题解决方法原创 2022-06-09 23:30:00 · 4151 阅读 · 5 评论 -
pip 无法卸载 pillow 解决方案 Not uninstalling pillow at /usr/lib/python3/dist-packages
1. 问题现象使用 pip 卸载 pillow 时无法卸载,报如下错误:$ sudo pip3 uninstall pillow Not uninstalling pillow at /usr/lib/python3/dist-packages, outside environment /usr2. 解决方法sudo apt remove python3-pil或者sudo apt remove python3-pil...原创 2021-12-04 08:23:24 · 4201 阅读 · 0 评论 -
ERROR: Failed compiling the bootloader. Please compile manually and rerun setup.py
1. 问题现象在使用 pip 安装 pyinstaller 时,有如下错误$ sudo pip3 install pyinstaller==4.5.1 -i https://pypi.douban.com/simple/Collecting pyinstaller==4.5.1 Downloading https://pypi.doubanio.com/packages/a9/d9/9fdfb0ac2354d059e466d562689dbe53a23c4062019da2057f0e原创 2021-12-02 20:05:59 · 2189 阅读 · 2 评论 -
Pyinstaller 打包 torch 后执行失败 OSError: could not get source code
1. 问题现象系统环境Python 3.6.9torch 1.2.0torchvision 0.4.0Pyinstaller 4.5.1Pyinstaller 打包 torch 后执行失败 OSError: could not get source code 。Traceback (most recent call last): File "main.py", line 29, in <module> File "<frozen importlib._boot原创 2021-11-30 20:43:57 · 1372 阅读 · 0 评论 -
Workbench Could not connect the SSH Tunnel Authentication error
1. 问题现象平日正常使用的 Workbench 在重启电脑之后发现无法连接到对应的数据库,workbench log显示SSH tunnel]: Authentication error opening SSH tunnel: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details查阅完整 log 发现如下内容:$ tail -f ~/.mysql/w原创 2021-11-19 19:40:05 · 2111 阅读 · 0 评论 -
pip install 豆瓣源、清华源、阿里源、中国科技大学源
豆瓣源https://pypi.douban.com/simple/清华源https://pypi.tuna.tsinghua.edu.cn/simple阿里云https://mirrors.aliyun.com/pypi/simple/中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/使用命令pip install xxx -i https://pypi.douban.com/simple/pip install .原创 2021-10-28 19:10:12 · 24631 阅读 · 0 评论 -
Ubuntu 16.04 安装 PyInstaller
sudo apt-get install python3-pipsudo pip3 install pefile==2018.8.8sudo pip3 install pyinstaller==3.3.1原创 2021-10-21 23:02:45 · 587 阅读 · 0 评论 -
pip 升级之后提示 bash: /usr/bin/pip3: No such file or directory
1. 问题现象pip 升级之后使用时报错:$ pip3 -Vbash: /usr/bin/pip3: No such file or directory通过命令查找 pip 位置$ which pip3/usr/local/bin/pip3发现 pip 升级之后的位置已经更改为 /usr/local/bin/pip ,但是 pip 的缓存地址依旧是 /usr/bin/pip2. 解决方法解决方法很简单,通过如下命令清除缓存$ hash -r$ pip3 -Vpip 20.3.4原创 2021-10-22 22:34:48 · 10709 阅读 · 5 评论 -
Python gRPC 安装(modules/canbus/proto/chassis.proto: File not found.)
1. 安装依赖库sudo pip3 install grpciosudo pip3 install protobufsudo pip3 install grpcio_tools2. 生成对应文件python -m grpc_tools.protoc -I=./protos --python_out=./rpc_pkg --grpc_python_out=./rpc_pkg ./protos/facegroup.proto原创 2021-10-22 22:05:58 · 2184 阅读 · 0 评论 -
Ubuntu16.04 pip3 install 报错 working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
1. 问题现象Exception:Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 209, in main status = self.run(options, args) File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 317, in run r原创 2021-10-22 22:20:16 · 221 阅读 · 0 评论 -
如何读取比机器内存大的文件(内存4G,文件 8G,读取大文件) ?
我们假设数据可以一行一行地处理,并且数据之间的没有相关性,那么我们有两种方法读取该文件。1. 使用生成器 yield 逐行读取到内存def read_file(filename): with open(filename, 'r', encoding='utf-8') as f: for line in f: yield lineline_co...原创 2020-03-09 20:45:04 · 3169 阅读 · 0 评论 -
安装 Python MySQL 驱动(mysql-connector-python、MySQL-python)
1. 安装由于 MySQL 服务器以独立的进程运行,并通过网络对外服务,所以,需要支持 Python 的MySQL 驱动来连接到 MySQL 服务器。目前,有两个MySQL驱动:mysql-connector-python:是MySQL官方的纯Python驱动;MySQL-python:是封装了MySQL C驱动的Python驱动。可以把两个都装上,使用的时候再决定用哪个:...原创 2019-11-18 21:09:47 · 1317 阅读 · 0 评论 -
Windows Python3.6 安装 IPython(Jupyter) qtconsole
确保 Python3.6 已经成功安装分别执行以下步骤:python –m pip install ipythonpython –m pip install pygmentspython –m pip install pyreadlinepython –m pip install pyzmq下载 pyqt 并安装https://www.lfd.uci.edu/~gohlke/...原创 2020-02-24 20:46:55 · 778 阅读 · 0 评论 -
IPython 更改默认字体大小
安装 IPython 之后发现默认的字体太小,不方便使用,故用以下方法进行修改默认字体大小。默认的字体如下图所示:修改方法在命令行输入 ipython profile create找到 ipython_qtconsole_config.py 文件路径,并修改其中的 c.IPythonWidget.font_size = 10 为任意自己喜欢的字体大小;重新在打开 I...原创 2019-02-27 23:13:13 · 1946 阅读 · 3 评论 -
jupyter qtconsole 配置文件的生成和修改
jupyter qtconsole 配置文件的生成和修改安装 Anaconda 之后默认会安装 Ipython, 但是输入 ipython qtconsole 之后默认的 Jupyter QtConsole 界面字体太小,不方便使用,通过下面方法可以修改字体大小。1. 生成 jupyter qtconsole 的配置文件在命令行输入以下命令jupyter qtconsole --gener...原创 2019-03-03 23:03:47 · 2081 阅读 · 3 评论 -
Anaconda3-5.0.1 输入ipython 出现 ImportError: cannot import name ‘create_prompt_application‘
在 Windows 系统上安装 Anaconda3-5.0.1 版本后,输入 ipython 结果出现如下错误:(G:\Anaconda3-5.0.1\install) C:\Users\wohu>ipythonTraceback (most recent call last): File "G:\Anaconda3-5.0.1\install\Scripts\ipython-scr...原创 2019-05-31 21:40:45 · 2050 阅读 · 0 评论 -
Ubuntu PyCharm cv2 无代码提示解决方法
1. 找到解释器配置界面## 2. 选择 opencv-python , 然后点击 OK 即可原创 2019-10-13 11:34:00 · 912 阅读 · 1 评论 -
ubuntu 系统 apt-get install python3-pip 依赖报错解决方法(源码 get-pip 安装 pip)
1. 直接安装报依赖错误直接使用 apt-get install python3-pip 安装sudo apt-get install python3-pip报以下依赖错误ubuntu@ubuntu:~/src$ sudo apt-get install python3-pipReading package lists... DoneBuilding dependency tree...原创 2020-05-06 22:10:03 · 17086 阅读 · 4 评论 -
uwsgi 安装报错 plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
1. Python3 安装 uwsgi 报错直接使用命令 sudo pip3 install uwsgi 安装如下错误:ubuntu@ubuntu:~/Downloads$ sudo pip3 install uwsgiCollecting uwsgi Downloading uwsgi-2.0.18.tar.gz (801 kB) |█████████████████████...原创 2020-05-07 21:02:08 · 2736 阅读 · 2 评论 -
[WARNING] unable to add QUERY_STRING=XXXX to uwsgi packet, consider increasing buffer size
1. 问题现象在用 flask uwsgi api 报文发送 GET 请求时,请求参数的 value 值 “XXX” 太长时,会报下面的错误。[WARNING] unable to add QUERY_STRING=XXXX to uwsgi packet, consider increasing buffer size2. 解决方法在 uwsgi 的配置文件 uwsgi.ini 或者命令行参数增加 buffer-sizebuffer-size = 32768参考链接:https://st原创 2020-05-14 22:19:31 · 528 阅读 · 0 评论 -
Ubuntu 安装 IPython、jupyter notebook
1. 升级 pipsudo pip3 install --upgrade pip2. 安装 IPythonIPython 5.x 是最后一个支持 Python2 的 IPython 。sudo pip2 install ipython==5.1Python3 的用户可通过如下命令安装最新版 IPython 。sudo pip3 install ipython3. 安装 jupytersudo pip3 install jupyter4. 启动安装完成后,输入 jupyter n原创 2020-07-08 23:13:18 · 547 阅读 · 0 评论 -
Python2 与 Python3 共存,pip2 与 pip3 共存切换设置
1. Python2 与 Python3 软链接设置wohu@ubuntu:/usr/bin$ ll /usr/bin/python*lrwxrwxrwx 1 root root 9 4月 16 2018 /usr/bin/python -> python2.7*lrwxrwxrwx 1 root root 9 4月 16 2018 /usr/bin/python2 -> python2.7*-rwxr-xr-x 1 root root 3633560 4原创 2020-07-09 22:44:10 · 756 阅读 · 0 评论 -
Jupyter Notebook 远程访问设置方法
1. 设置密码In [1]: from notebook.auth import passwd In [2]: passwd()原创 2020-08-11 22:06:29 · 555 阅读 · 0 评论 -
Could not install packages due to an EnvironmentError: [Errno 28] No space left on device
Could not install packages due to an EnvironmentError: [Errno 28] No space left on device1. 问题现象安装 opencv-python 时报错:wohu@ubuntu:~# pip2 install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple --no-cache-dir --timeout=100000Looking in原创 2021-01-12 22:08:31 · 959 阅读 · 0 评论