简体   繁体   English

在Mac上安装virtualenvwrapper-找不到hook_loader.py pkg_resources

[英]virtualenvwrapper install on Mac - hook_loader.py pkg_resources not found

I'm trying to setup virtualenv & virtualenvwrapper on my mac but am experiencing problems with virtualenvwrapper. 我正在尝试在Mac上设置virtualenv和virtualenvwrapper,但遇到virtualenvwrapper的问题。

I've looked through the other related posts regarding this and tried some things but I still get an error when my .bash_profile loads on the line 我浏览了与此相关的其他相关文章并尝试了一些方法,但是当我的.bash_profile加载到行上时,仍然出现错误

source /usr/local/bin/virtualenvwrapper.sh

error msg: File "", line 1, in File "/Library/Python/2.7/site-packages/virtualenvwrapper/hook_loader.py", line 16, in import pkg_resources ImportError: No module named pkg_resources* 错误消息:导入文件pkg_resources中的文件“ /Library/Python/2.7/site-packages/virtualenvwrapper/hook_loader.py”中第16行的文件“”,导入错误:没有名为pkg_resources *的模块*

'which python' yields '/usr/local/bin/python'

and running IDLE tells me its using v2.7.3 并运行IDLE告诉我它使用v2.7.3

I've previously run 我以前跑过

pip install virtualenv

and

pip install virtualenvwrapper

and they both appeared to run through fine. 他们俩似乎都过得不错。

Running a 'find' shows that pkg_resources.py is in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py 运行'find'表明pkg_resources.py位于/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py

my PATH is /usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin 我的路径是/ usr / local / bin:/ usr / local / bin:/ usr / bin:/ bin:/ usr / sbin:/ sbin:/ usr / X11 / bin

also cat .bash_profile yields 还猫.bash_profile产量

export WORKON_HOME=$HOME/workspace/virtualenvs
export PROJECT_HOME=$HOME/workspace/repos
export PATH=/usr/local/python:$PATH
source /usr/local/bin/virtualenvwrapper.sh

Anyone else had this problem and found a fix? 其他人遇到此问题并找到解决办法?

many thanks 非常感谢

I had the same error this morning. 我今天早上有同样的错误。 Upgrading setuptools on my base python environment (not inside a virtual environment) fixed this issue. 在我的基本python环境(不在虚拟环境中)上升级setuptools解决了此问题。 Here is the command I ran 这是我运行的命令

sudo pip install setuptools --upgrade

I had setuptools installed before, but maybe I had a bad version or a corrupted install. 我之前安装过setuptools,但是也许我的版本错误或安装损坏。 Upgrading with --upgrade fixed it. 使用--upgrade升级可修复该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM