New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用 python 库遇到的问题 #19
Comments
2.cv2这个库之前没有接触过,不过 demo 需要安装这个库,便就引入了这个库,然后安装这个库(pycharm 提示没有找到,按提示安装。。。)最后安装失败:
解决方法:这里面有一个隐藏问题,即安装库的名称应该是
即使更换了源,安装速度还是特别感人,而且还会出现超时错误。。。 # 超时设置
pip --default-timeout=100 install package_name 顺便把 pip 的源也换了吧(早该换了。。。) # 升级 pip
pip install pip -U
# 确保 升级 pip 到最新的版本 (>=10.0.0) 后
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple 这就完了。。。naive 用
解决 cv2 引入问题的直接办法,是在设置解释器的环境中,直接安装,但安装的不是 |
3.anaconda1. An HTTP error occurred when trying to retrieve this URL.# wan
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/bottleneck-1.3.2-py37h2a96729_1.conda>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way. 解决方法:更换源 # anaconda prompt
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes 不想使用命令行,可以编辑 channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: true 2. The current user does not have write permissions to the target environment.EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
environment location: C:\xx\Anaconda3 解决方法:(可能是因以管理员身份安装的导致的)调整文件权限,具体参考 安装TensorFlow遇到 The current user does not have write permissions to the target environment解决方案 3.HTTP 000 CONNECTION FAILED for url今天在学习 turtle 绘图时,看来一下版本,发现比较老了...于是准备更新,在使用 conda 更新,报错了:
试了几次都没有成功,然后换了几次源,依旧没有成功过...直到看到这篇文章,我选择将源 URL 的 一般的包查看版本,使用 # 103
_ver = "turtle 1.1b- - for Python 3.1 - 4. 5. 2009" 所以查看版本使用 4.InvalidVersionSpecError使用 anaconda prompt 更新:
环境参数:
解决方法 1:
实测第一步无法成功,issue#10618 也有人如此反馈。 解决方法 2:进入 解决方法 3:一种降低版本(有人指出 4.3.30 版本也有问题),一种提高版本(issue#198 bottle 猜测 升级(4.10.1)以后,确实没有这个问题了。但是,navigator 启动不了了...:rofl::rofl::rofl: 参考: InvalidVersionSpecError: Invalid version spec: =2.7 #10618 |
4.pip4.1.
|
5.
|
6.
|
7.引入包错误
具体: $ py app.py
Traceback (most recent call last):
File "app.py", line 3, in <module>
from flask import Flask, render_template, url_for, request, redirect
File "/home/.../todo_app/venv/lib/python3.8/site-packages/flask/__init__.py", line 14, in <module>
from jinja2 import escape
ImportError: cannot import name 'escape' from 'jinja2' (/home/.../todo_app/venv/lib/python3.8/site-packages/jinja2/__init__.py)
(venv) 分析: jinja 升级版本移除了这个函数。 方案: 1.降级:
具体: $ py app.py
Traceback (most recent call last):
File "app.py", line 3, in <module>
from flask import Flask, render_template, url_for, request, redirect
File "/home/.../todo_app/venv/lib/python3.8/site-packages/flask/__init__.py", line 19, in <module>
from . import json
File "/home/.../todo_app/venv/lib/python3.8/site-packages/flask/json/__init__.py", line 15, in <module>
from itsdangerous import json as _json
ImportError: cannot import name 'json' from 'itsdangerous' (/home/.../todo_app/venv/lib/python3.8/site-packages/itsdangerous/__init__.py)
(venv) 分析:还是版本问题 方案:解决这个问题后,又出现了其他引入问题,索性将版本都升级到最新版本,成功运行。 |
你好,请问你遇到过如下错误吗? |
@qixingyu-code 同问,请问朋友你解决了这个问题不 |
1.time
使用
time
模块时,误输time.strftime('%Y%m%D')
;在 Python 参考手册.,可以用查到,没有明确指出
%D
的含义。暂时没弄明白,先记录一下这个结果。虽然手册没说,但通过实际测试发现,
%D
表示美式日期。The text was updated successfully, but these errors were encountered: