python包管理——python venv和pycharm
Posted Locutus
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python包管理——python venv和pycharm相关的知识,希望对你有一定的参考价值。
1. python venv
配置默认包安装位置
# python3 -m site -help
/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site.py
# vim /usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site.py
ENABLE_USER_SITE = True
USER_SITE = "/Users/jackyue/python3/python_venv/lib/python3.9/site-packages"
USER_BASE = "/Users/jackyue/python3/python_venv"
# python3 -m site
USER_BASE: '/Users/jackyue/python3/python_venv' (exists)
USER_SITE: '/Users/jackyue/python3/python_venv/lib/python3.9/site-packages' (exists)
ENABLE_USER_SITE: True
激活虚拟环境,查看默认包安装位置。
# source /Users/jackyue/python3/python_venv/bin/activate
# pip3 -V
pip 23.0.1 from /Users/jackyue/python3/python_venv/lib/python3.9/site-packages/pip (python 3.9)
2. pycharm
在ide里,配置python解释器和python虚拟环境文件夹(如配置/User/jack/python3/python_venv,那么路径下应该没有python_venv文件夹),然后在pycharm的setting中安装包依赖。
以上是关于python包管理——python venv和pycharm的主要内容,如果未能解决你的问题,请参考以下文章
python中使用flask时遇到的markupsafe._compat包缺失的问题与解决
(OSError: Command /opt/venv2/bin/python3 - setuptools pip wheel failed with error code 2)Linux下面创建py
使用 virtualenv/venv 和 pip 管理虚拟环境