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中安装包依赖。

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐