python历年入坑记录大全

python

anaconda

conda

HTTP 000 CONNECTION FAILED

conda update conda --force

WARNING: The --force flag will be removed in a future conda release.
         See 'conda update --help' for details about the --force-reinstall
         and --clobber flags.


Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/win-64/current_repodata.json>
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.
'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/win-64'

解决方法:1.看看是不是安装了火绒软件,关闭防火墙,再试一次
        2.换站点,或者把https改成http
**但是这两种方法我都没成功**

####conda更新:PackageNotInstalledError: Package is not installed in prefix. 
解决方法

conda update --prefix /Users/omeiko/opt/miniconda3 anaconda

PackageNotInstalledError: Package is not installed in prefix.
prefix: /Users/omeiko/opt/miniconda3
package name: anaconda

当你运行 conda update的时候,会提示你是否想运行conda update --prefix /Users/omeiko/opt/miniconda3 anaconda,当你运行了之后,就会显示上述的错误提示。
出现问题的原因是你安装的conda是miniconda而不是anaconda。

解决方法
方法1
执行conda install anaconda,安装anaconda,然后再运行就没问题了。

方法2
执行conda update --prefix /Users/omeiko/opt/miniconda3 conda,不需要执行anaconda的更新。
或者执行conda update --name base conda,更新base 命令。
————————————————
原文链接:https://blog.csdn.net/weixin_35436966/article/details/114958455

#### RemoveError: 'setuptools' is a dependency of conda and cannot be removed from conda's operating environment.
今天用conda install 任何包都会出现这个错误:
RemoveError: 'setuptools' is a dependency of conda and cannot be removed from
conda's operating environment.
试了第一种方法:
pip uninstall install setuptools  然后conda install setuptools ,没有用,依然报错
第二种:
conda update conda 没用,报相同错误
第三种:
conda update --force conda,成功,没有报错。
重新安装一下其他的包,比如numpy,conda install numpy 成功,没有报错。看来是解决了。
####Warning: 2 possible package resolutions (only showing differing packages)
解决办法:

conda update --strict-channel-priority --all

重置conda的信道优先级
如果用完这个命令还不行,试试下面几个:

conda install anaconda-clean
anaconda-clean --yes
conda update --all

#pandas
##read_excel
###UserWarning: Workbook contains no default style, apply openpyxl's default warn("Workbook contains no default style, apply openpyxl's default")
这个警告也是字面意思,打开的这个excel表没有默认样式,openpyxl要给它赋默认样式,我遇到这个警告的原因是xlsx文件是由Apache POI创建,并不是Microsoft EXCEL创建。文件属性里程序名称是Apache POI

**解决方法:**用EXCEL打开文件,做些改动,然后保存,程序属性变成Microsoft EXCEL,同时应该也保存了默认的excel样式

##to_excel()
### FutureWarning: As the xlwt package is no longer maintained, the xlwt engine will be removed in a future version of pandas. 
This is the only engine in pandas that supports writing in the xls format. Install openpyxl and write to an xlsx file instead. You can set the option io.excel.xls.writer to 'xlwt' to silence this warning. While this option is deprecated and will also raise a warning, it can be globally set and the warning suppressed.
**解决方法:**
把   wss_bonds_data(govn_bond).to_excel(path+'\'+'export_file.xls')
改成 wss_bonds_data(govn_bond).to_excel(path+'\'+'export_file.xlsx')
即可。
#MySQL
##create table
#### warning(s): 1681 Integer display width is deprecated and will be removed in a future release. 1681 Integer display width is deprecated and will be removed in a future release. 1681 Integer display width is deprecated and will be removed in a future release.
**解决方法:**
在设置int型数据类型时,只写int即可(不带括号),不用指定宽度:int(7)。
原文地址:https://www.cnblogs.com/treasury-manager/p/14675574.html