1. 前言

我在使用mac安装virtualwrapper的时候遇到了问题,搞了好长时间,才弄好,在这里总结一下分享出来,供遇到相同的问题的朋友使用,少走些弯路。

2. 问题说明

Mac默认系统的python2,而我自己用的是brew安装的python3

下面是我安装过程中出现的问题

  1. 安装virtualwrapper,打开终端,输入如下的命令
pip3 install virtualenv
pip3 install virtualenvwrapper
  1. 在配置文件~/.bash_profile中添加代码
# Settings for virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
  1. 让配置生效
source ~/.bash_profile

这时,出现了如下问题:

/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.

3. 原因分析

从报错信息VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.这一句话来看,是环境指向python2的路径,所以我们只需要将这个环境变量修改为python3的路径即可。

4. 解决办法

  1. 打开配置文件
vim ~/.bash_profile
  1. 在配置文件中添加一行代码
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
  1. 让配置生效, 大功告成
source ~/.bash_profile

最新文章

  1. Win7下安装Centos7
  2. java-汉字转换拼音-pinyin4j.jar
  3. POJ 2431 Expedition(优先队列、贪心)
  4. JavaScript_Math函数
  5. [算法导论]二叉查找树的实现 @ Python
  6. (7)基本工作流(使用AndroidStudio编辑Cocos项目)
  7. [Windows Server] 在 Windows Server 2012 上安裝 .NET Framework 3.5 - 摘自网络
  8. Axure自动幻灯片制作
  9. Sumsets(完全背包)
  10. C#应用Newtonsoft.Json.dll,控制json的时间格式
  11. C++指针数组和指向指针的指针
  12. JS中遍历语法的比较
  13. zTree多条件模糊查询
  14. gitlab wiki 500
  15. spring的DI.IoC是什么
  16. python之bytes和string
  17. MySQL——基础操作
  18. 【AGC005F】Many Easy Problems FFT 容斥原理
  19. HTTPS IP直连问题小结
  20. SDWebImage之SDWebImageManager

热门文章

  1. [NOI2004]小H的小屋 贪心
  2. 10.04 FZSZ模拟Day1 总结
  3. 4.7.6 Compaction of LR Parsing Tables
  4. Web安全总结摘录
  5. 33. Extjs中的tree节点的操作
  6. JAVA接口和抽象类的特点
  7. ngCordova插件说明
  8. Springboot 相关注解大全
  9. Android 性能优化(3)性能工具之「调试 GPU 过度绘制」Debug GPU Overdraw Walkthrough-查看哪些view过度绘制了
  10. 双摆模拟 python(转)