从 sys.path 中删除条目
Remove entry from sys.path
通过自制软件安装一些 Python 模块后,自制软件告诉我 运行 以下代码。
我不再需要这些模块,想要清理所有内容。我可以删除(我应该吗?)删除此条目?我如何删除它?
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
mkdir -p /Users/rain/.local/lib/python2.7/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/USERNAME/.local/lib/python2.7/site-packages/homebrew.pth
Mac OsX 10.10.2
如果您没有使用任何 Homebrew 安装的 python 模块,您可以安全地删除 /Users/USERNAME/.local/lib/python2.7/site-packages/homebrew.pth
。
.pth 文件是向 sys.path
添加路径的一种方式。 .pth 文件中作为路径的行被添加到 sys.path
; .pth 文件中以 import
开头的行被执行。
homebrew.pth
文件中以 import
开头的行使 Homebrew 前缀下的 site-packages 目录成为一个特殊的 site-packages 目录,它都将其添加到 sys.path 和确保读取和处理它包含的任何 .pth 文件。
通过自制软件安装一些 Python 模块后,自制软件告诉我 运行 以下代码。 我不再需要这些模块,想要清理所有内容。我可以删除(我应该吗?)删除此条目?我如何删除它?
Python modules have been installed and Homebrew's site-packages is not in your Python sys.path, so you will not be able to import the modules this formula installed. If you plan to develop with these modules, please run:
mkdir -p /Users/rain/.local/lib/python2.7/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/USERNAME/.local/lib/python2.7/site-packages/homebrew.pth
Mac OsX 10.10.2
如果您没有使用任何 Homebrew 安装的 python 模块,您可以安全地删除 /Users/USERNAME/.local/lib/python2.7/site-packages/homebrew.pth
。
.pth 文件是向 sys.path
添加路径的一种方式。 .pth 文件中作为路径的行被添加到 sys.path
; .pth 文件中以 import
开头的行被执行。
homebrew.pth
文件中以 import
开头的行使 Homebrew 前缀下的 site-packages 目录成为一个特殊的 site-packages 目录,它都将其添加到 sys.path 和确保读取和处理它包含的任何 .pth 文件。