以下所有内容既有原创,又有整理技巧,方便查阅,来源无从考证,不定期更新
删除所有pip包
pip freeze | grep -v "^-e" | xargs pip uninstall -y
或者python交互中粘贴进入一下代码
import os
result = os.popen('pip freeze').read()
for line in result.splitlines():
if len(line) > 0:
os.system('pip uninstall -y %s' % line)
windows下添加右键菜单(另存AnacondaHere.reg并导入)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\AnacondaHere]
@="Anaconda Here"
"Icon"="C:\\Windows\\System32\\cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\AnacondaHere\command]
@="cmd.exe \"/K\" {修改为Anaconda安装目录}\\Scripts\\activate.bat"
pip卸载依赖包
pip install pip-autoremove # 安装
pip-autoremove package-name-here # 和 pip 一样用
conda修改源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
临时使用: 可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple 例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent,这样就会从清华这边的镜像去安装gevent库。
永久修改,一劳永逸: linux下,修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至tuna,内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
VSCode下pylint不识别pyqt5 建立
~/.pylintrc
[MASTER]
extension-pkg-whitelist=PyQt5
安装64位anaconda基础上,安装32位环境
创建环境
set CONDA_FORCE_32BIT=1
conda create -n py27 python=2.7
进入环境
set CONDA_FORCE_32BIT=1
activate py27 //激活环境
deactivate py27 //退出环境
注意每次都要切换
set CONDA_FORCE_32BIT=1 //切换到32位
set CONDA_FORCE_32BIT= // 切换到64位
查看当前conda工作平台
conda info
pyqt5 high dpi支持
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QApplication
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
app = QApplication(sys.argv) # 必须在?