1、pycharm创建项目文件
2、执行virtulenv venv
3、执行activate.bat文件,进入环境
4、执行pip install -r requirements.txt安装依赖包
第4步出现问题,本机缺少visual c++编译依赖包
cffi=1.4.4
python 312版本
pip install 安装报错
解决方法:
1.查询 https://pypi.org/search/?q=cffi 当前最新的包版本 [我这边查询到是cffi==1.16.0]
2.修改项目下载依赖文件
requirements.txt
将 cffi=1.4.4 修改成 cffi=1.16.0[查询的最新包的版本号]
3.重新执行命令
pip install -r .\requirements.txt
4.如果之前有根据依赖文件安装过部分包,需要删除的话执行
pip uninstall -y -r .\requirements.txt
pycharm 直接使用new project 创建project,使用virtualenv方式 指定anoconda的python解释器作为project的python解释器。
在使用pip install的时候,出现SSL错误:
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/aiofiles/
Could not fetch URL https://pypi.org/simple/aiofiles/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/aiofiles/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement aiofiles==0.6.0 (from versions: none)
ERROR: No matching distribution found for aiofiles==0.6.0。
原因是在windows powershell中使用anoconda的pip命令,需要在环境变量中添加如下三项:
D:\Anaconda3
D:\Anaconda3\Scripts
D:\Anaconda3\Library\bin
(https://stackoverflow.com/questions/45954528/pip-is-configured-with-locations-that-require-tls-ssl-however-the-ssl-module-in)
powershell中添加环境变量方法:
$env:Path += ";D:\Anaconda3"
(https://stackoverflow.com/questions/714877/setting-windows-powershell-environment-variables)
查看环境变量方法:dir env:
添加后一切正常。