common problem

##################################
##################################

1.
下载依赖报错:
pip install Twisted==18.9.0
#Running setup.py install for Twisted ... error
参考文档:http://blog.sina.com.cn/s/blog_13d9a41c20102yaqp.html
解决:
ps:官网上没有Twisted==18.9.0这个版本了
requirements.txt里面的Twisted==18.9.0换成Twisted==19.2.1
官网地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
选择对应版本安装,python解释器版本,以及系统版本位数 Twisted-19.2.1-cp36-cp36m-win_amd64
下载到D:git_jstvenv_yct_workerScripts目录,
在虚拟环境下或者命令行下输入 pip install D:git_jstvenv_yct_workerScriptsTwisted-19.2.1-cp36-cp36m-win_amd64.whl,即可成功安装Twisted库

##################################
##################################

2.
python virtualenv
windows pycharm为新项目配置虚拟环境
参考文档:https://www.cnblogs.com/zhouzhishuai/p/8120335.html
每个应用可能需要各自拥有一套“独立”的Python运行环境。virtualenv就是用来为一个应用创建一套“隔离”的Python运行环境

PyCharm创建virtualenv方法
打开Project Interpreters-->add python interpreter-->Virtualenv Environment
配置新环境:
在Location中填写新环境的解释器目录(必须是空的目录,自己新建一个);
在Base interpreter下拉框中选择Python解释器;
勾选Inherit global site-packages可以使用base interpreter中的第三方库,不选将和外界完全隔离;
勾选Make available to all projects可将此虚拟环境提供给其他项目使用。

##################################
##################################

3.
python requirements.txt
需要virtualenv支持
导出一个requirements.txt,把需要安装的第三方库放在里面

参考文档:https://blog.csdn.net/qq_25174673/article/details/85268624

在项目根目录下执行,生成requirements.txt文件
pip freeze > requirements.txt
安装requirements.txt依赖,一般pycharm会自动提示
pip install -r requirements.txt

##################################
##################################

4.
win,pycharm,虚拟环境中升级pip问题
Requirement already up-to-date: pip
在python中,遇到问题升级pip(从pip10.0,升级为18.0),显示已经为最新,
如下所示:
Requirement already up-to-date: pip in c:usersadministratorpythonvenvmodellibsite-packages (18.0)
用pip -V 查看仍然是10.0版本

解决:
参考文档:
https://blog.csdn.net/adayan_2015/article/details/82802052
删除新下载的D:git_jstvenv_yct_workerLibsite-packagespip-19.1.1.dist-info
虚拟环境下运行命令:python -m pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ --upgrade pip

##################################
##################################

原文地址:https://www.cnblogs.com/xujinjin18/p/11180958.html