python - 如何自动激活python虚拟环境?
问题描述
您好,我的电脑上安装了两个 python,python2.7.6 和 python2.7.11,我使用 python2.7.11 作为虚拟环境版本。如何在重新启动设备时自动将终端设置为 python2.7.11。
解决方案
echo $PATH
这将打印出您当前配置的 PATH。其中之一将包含python2.7.6
.
激活虚拟环境后使用export PATH="new path here without the python folder"
Run将其删除。which python
将此路径添加到$PATH
例子:
export PATH="$PATH:/usr/local/bin/python"
将您所做的更改添加到~/.profile
或~/.bash_profile
中。否则,您运行的命令将仅计入当前 SSH 会话。profile
在每个新的 SSH 会话中运行。
推荐阅读
- amazon-web-services - Greengrass_HelloWorld lambda doesn't publish to Amazon IoT console
- javascript - 如何将一串带有逗号的数字转换为整数并将它们相加?
- date - boto 3 - 丢失日期格式
- laravel - laravel 组合两个 csv 而不覆盖每个中的相似数据
- r - How to knitr beamer slides using Frankfurt theme without loosing navigation circles
- amazon-web-services - AWS Cloudwatch 将日志记录到 Azure Log Analytics
- google-sheets - 广泛特定单元格的总和
- c - 使用 (char **) 与 (const * char *) 与 (const char **)
- java - 如何在 Windows 上设置 JUNIT 以使用 Sublime 和命令行?
- reactjs - Reactjs:使用类与功能组件的最佳实践是什么?