1- pip包路径
terminal-> python2/python3-> import numpy -> numpy:
放在了conda中,在~/.bashrc中设置PATH即可:
2- 去掉sys.path中的python执行时的找包路径列表
terminal运行”python **.py“时使用sys.path中的包
添加目标路径:sys.path.append("...")
3- 寻找python路径:whereis python
4- python建立软连接:
sudo ln -s ../../../Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 /usr/local/bin/python3
如果已存在则删除:rm ...
寻找python3 "whereis python3"时:/usr/bin/python3
5- python各个路径:
系统自带python:
/System/Library/Frameworks/Python.framework/Versions/2.7/Pythonbrew安装python:
/usr/local/Cellar/python/3.7.5/bin/python3.7用户安装的python:
用户安装的python(use): no use
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 <= sudo ln -s ../../../Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 /usr/local/bin/python3虚拟环境下安装的python:
/Users/wlx/_workplace/DL/venv/bin/python3.7
6- 比较/.bashrc和/.bash_profile
前者:非交互登录shell,用于更改设置、别名,以任何方式打开shell,配置都生效
后者:交互式登录shell,用于更改环境变量,只被执行一次