pip install不再适用于virtualenv,不知何故pip正试图用root安装

时间:2015-12-02 20:17:24

标签: python macos pip

------编辑重新开始---------

我有一个virtualenv的问题,我不知道我是如何造成它的。我遇到的问题是我无法在我的烧瓶应用程序的site-packages目录中安装任何flask-extensions。

我有一个之前覆盖过的stackoverflow问题,但我相信我发现了root问题,问题出在virtualenv本身。执行=IIF(SUM(IIF(Isnothing(Fields!Total.Value),0,Fields!Total.Value)) = 0, "", SUM(IIF(Isnothing(Fields!Total.Value),0,Fields!Total.Value)).ToString + " J" ) 时出现错误:

virtualenv env

New python executable in env/bin/python Please make sure you remove any previous custom paths from your /Users/drubio/.pydistutils.cfg file. Installing setuptools, pip, wheel... Complete output from command /Users/drubio/example/env/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel: Ignoring indexes: https://pypi.python.org/simple The directory '/Users/drubio/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/Users/drubio/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting setuptools Collecting pip Collecting wheel Installing collected packages: setuptools, pip, wheel Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/basecommand.py", line 211, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/commands/install.py", line 311, in run root=options.root_path, File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/req/req_set.py", line 646, in install **kwargs File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/req/req_install.py", line 803, in install self.move_wheel_files(self.source_dir, root=root) File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/req/req_install.py", line 998, in move_wheel_files isolated=self.isolated, File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/wheel.py", line 339, in move_wheel_files clobber(source, lib_dir, True) File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/wheel.py", line 282, in clobber ensure_dir(dest) # common for the 'include' path File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/utils/__init__.py", line 71, in ensure_dir os.makedirs(path) File "/Users/drubio/example/env/lib/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/Users/drubio/example/env/lib/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/Users/drubio/example/env/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/lib' ---------------------------------------- ...Installing setuptools, pip, wheel...done. Traceback (most recent call last): File "/usr/local/bin/virtualenv", line 9, in <module> load_entry_point('virtualenv==13.1.2', 'console_scripts', 'virtualenv')() File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv.py", line 832, in main symlink=options.symlink) File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv.py", line 1004, in create_environment install_wheel(to_install, py_executable, search_dirs) File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv.py", line 969, in install_wheel 'PIP_NO_INDEX': '1' File "/Library/Python/2.7/site-packages/virtualenv-13.1.2-py2.7.egg/virtualenv.py", line 910, in call_subprocess % (cmd_desc, proc.returncode)) 中有某种权限被拒绝,我不确定这意味着什么。有没有办法完全删除virtualenv。新应用程序的/lib目录不包含激活文件或任何内容。

此外,运行这些命令会产生以下结果:

bin

但是当我执行(sudo) pip uninstall virtualenv zsh: /bin/pip: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory sudo: unable to execute /bin/pip: No such file or directory which virtualenv时,我明确地将它们放在which pip/usr/local/bin/virtualenv/下。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我发现了问题!问题出在此文件/Users/drubio/.pydistutils.cfg

对于我遇到的另一个问题(我记不住了)我需要将这两行用于解决方法:

[install]
prefix=''

删除这些行使它工作。