当前位置: 首页 > 知识库问答 >
问题:

Virtualenv未安装pip

苏健柏
2023-03-14

我正在尝试在新项目文件夹中安装新的虚拟环境,但它没有在虚拟环境中安装pip

下面是bash日志:

$ virtualenv --version
12.1.1

$ sudo virtualenv venv
Password:
New python executable in venv/bin/python2.7
Not overwriting existing python script venv/bin/python (you must use venv/bin/python2.7)
Please make sure you remove any previous custom paths from your /Users/keithy/.pydistutils.cfg file.
Installing setuptools, pip...done.

$ source venv/bin/activate

(venv) $ which python
/Users/keithy/Desktop/learn/flasky/venv/bin/python

(venv) $ which pip
/usr/local/bin/pip

(venv) $ ls -l venv/bin
total 80
-rw-r--r--  1 root    staff   2220 May 18 08:48 activate
-rw-r--r--  1 root    staff   1276 May 18 08:48 activate.csh
-rw-r--r--  1 root    staff   2489 May 18 08:48 activate.fish
-rw-r--r--  1 root    staff   1137 May 18 08:48 activate_this.py
lrwxr-xr-x  1 root    staff      9 May 18 08:53 python -> python2.7
lrwxr-xr-x  1 root    staff      9 May 18 08:53 python2 -> python2.7
-rwxr-xr-x  1 keithy  staff  12616 May 18 08:53 python2.7

(venv) $ pip install flask-bootstrap
Collecting flask-bootstrap
  Downloading Flask-Bootstrap-3.3.4.1.tar.gz (442kB)
    100% |################################| 446kB 1.9MB/s
Requirement already satisfied (use --upgrade to upgrade): Flask>=0.8 in /lib/python2.7/site-packages (from flask-bootstrap)
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in /lib/python2.7/site-packages (from Flask>=0.8->flask-bootstrap)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in /lib/python2.7/site-packages (from Flask>=0.8->flask-bootstrap)
Requirement already satisfied (use --upgrade to upgrade): itsdangerous>=0.21 in /lib/python2.7/site-packages (from Flask>=0.8->flask-bootstrap)
Requirement already satisfied (use --upgrade to upgrade): markupsafe in /lib/python2.7/site-packages (from Jinja2>=2.4->Flask>=0.8->flask-bootstrap)
Installing collected packages: flask-bootstrap
  Running setup.py install for flask-bootstrap
    error: could not create '/lib/python2.7/site-packages/flask_bootstrap': Permission denied
    Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/var/folders/rx/j0sk_6vs0dg59w3q4rm_wmwc0000gn/T/pip-build-wFK2ha/flask-bootstrap/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/rx/j0sk_6vs0dg59w3q4rm_wmwc0000gn/T/pip-UnbbND-record/install-record.txt --single-version-externally-managed --compile:
    running install

    running build

    running build_py

    creating build

    creating build/lib

    creating build/lib/flask_bootstrap

    copying flask_bootstrap/__init__.py -> build/lib/flask_bootstrap

    running egg_info

    writing requirements to Flask_Bootstrap.egg-info/requires.txt

    writing Flask_Bootstrap.egg-info/PKG-INFO

    writing top-level names to Flask_Bootstrap.egg-info/top_level.txt

    writing dependency_links to Flask_Bootstrap.egg-info/dependency_links.txt

    warning: manifest_maker: standard file '-c' not found



    reading manifest file 'Flask_Bootstrap.egg-info/SOURCES.txt'

    reading manifest template 'MANIFEST.in'

    writing manifest file 'Flask_Bootstrap.egg-info/SOURCES.txt'

    creating build/lib/flask_bootstrap/static

    copying flask_bootstrap/static/jquery.js -> build/lib/flask_bootstrap/static

    copying flask_bootstrap/static/jquery.min.js -> build/lib/flask_bootstrap/static

    copying flask_bootstrap/static/jquery.min.map -> build/lib/flask_bootstrap/static

    creating build/lib/flask_bootstrap/static/css

    copying flask_bootstrap/static/css/bootstrap-theme.css -> build/lib/flask_bootstrap/static/css

    copying flask_bootstrap/static/css/bootstrap-theme.css.map -> build/lib/flask_bootstrap/static/css

    copying flask_bootstrap/static/css/bootstrap-theme.min.css -> build/lib/flask_bootstrap/static/css

    copying flask_bootstrap/static/css/bootstrap.css -> build/lib/flask_bootstrap/static/css

    copying flask_bootstrap/static/css/bootstrap.css.map -> build/lib/flask_bootstrap/static/css

    copying flask_bootstrap/static/css/bootstrap.min.css -> build/lib/flask_bootstrap/static/css

    creating build/lib/flask_bootstrap/static/fonts

    copying flask_bootstrap/static/fonts/glyphicons-halflings-regular.eot -> build/lib/flask_bootstrap/static/fonts

    copying flask_bootstrap/static/fonts/glyphicons-halflings-regular.svg -> build/lib/flask_bootstrap/static/fonts

    copying flask_bootstrap/static/fonts/glyphicons-halflings-regular.ttf -> build/lib/flask_bootstrap/static/fonts

    copying flask_bootstrap/static/fonts/glyphicons-halflings-regular.woff -> build/lib/flask_bootstrap/static/fonts

    copying flask_bootstrap/static/fonts/glyphicons-halflings-regular.woff2 -> build/lib/flask_bootstrap/static/fonts

    creating build/lib/flask_bootstrap/static/js

    copying flask_bootstrap/static/js/bootstrap.js -> build/lib/flask_bootstrap/static/js

    copying flask_bootstrap/static/js/bootstrap.min.js -> build/lib/flask_bootstrap/static/js

    copying flask_bootstrap/static/js/npm.js -> build/lib/flask_bootstrap/static/js

    creating build/lib/flask_bootstrap/templates

    creating build/lib/flask_bootstrap/templates/bootstrap

    copying flask_bootstrap/templates/bootstrap/base.html -> build/lib/flask_bootstrap/templates/bootstrap

    copying flask_bootstrap/templates/bootstrap/fixes.html -> build/lib/flask_bootstrap/templates/bootstrap

    copying flask_bootstrap/templates/bootstrap/google.html -> build/lib/flask_bootstrap/templates/bootstrap

    copying flask_bootstrap/templates/bootstrap/pagination.html -> build/lib/flask_bootstrap/templates/bootstrap

    copying flask_bootstrap/templates/bootstrap/utils.html -> build/lib/flask_bootstrap/templates/bootstrap

    copying flask_bootstrap/templates/bootstrap/wtf.html -> build/lib/flask_bootstrap/templates/bootstrap

    running install_lib

    creating /lib/python2.7/site-packages/flask_bootstrap

    error: could not create '/lib/python2.7/site-packages/flask_bootstrap': Permission denied

    ----------------------------------------
    Command "/usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/var/folders/rx/j0sk_6vs0dg59w3q4rm_wmwc0000gn/T/pip-build-wFK2ha/flask-bootstrap/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/rx/j0sk_6vs0dg59w3q4rm_wmwc0000gn/T/pip-UnbbND-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /var/folders/rx/j0sk_6vs0dg59w3q4rm_wmwc0000gn/T/pip-build-wFK2ha/flask-bootstrap

这里的问题是pip没有安装在venv/bin中。我的问题是-这正常吗?我应该自己安装pip吗?如果是这样,我将如何做到这一点,以便当我运行类似于pip安装mypack的东西时,mypack安装在venv中?

顺便说一句,我想把所有东西都放在2.7里keithy是我的计算机用户名。

共有2个答案

葛成济
2023-03-14

我用一种非传统的方式修复了它:我只是从头开始重新安装了OSXYosemite。我认为这是值得的,因为我的各种python发行版都搞砸了,特别是因为我把默认的Apple python发行版搞砸了。我进行了干净的安装,然后brew安装python,并使用了brew版本。现在一切都很好virtualenv-venv现在将pip正确安装到venv文件夹中。

叶鸿振
2023-03-14

我通过删除$HOME/解决了它。pydistutils.cfg.

 类似资料:
  • 我安装twisted时遇到问题 PIP1.1 from/home/chris/GL/GLBackend/glenv/lib/python2.7/site-packages/pip-1.1-py2.7.egg(python 2.7) 创建虚拟环境 在glenv/bin/python2.7中创建新的python可执行文件也在glenv/bin/python中创建可执行文件安装分发...........

  • 问题内容: 所以我试图在我的virtualenv中(在控制台中)运行一个简单的matplotlib示例。这是代码: 但是,当我运行它时,我得到: ImportError:Gtk *后端需要安装pygtk。 现在,乐趣开始了。我试图点安装pygtk,但它抛出: 我检查了文件并说尝试。然而。我不太确定如何在virtualenv中执行此操作。为了在virtualenv中安装pygtk,我在哪里解压缩源代

  • 问题内容: 我为Django 1.9项目创建了virtualenv。我试图通过pip安装mysqlclient或mysql-python,但它们都给我错误。 两者都给我相同的错误信息: 命令“ python setup.py egg_info”在/ private / var / folders / r4 / bkv_4t9s4r140pjkgv6lsq8w0000gn / T / pip-bui

  • 问题内容: 安装了virtualenv,激活了它,安装了pip的flask,但是,当我尝试运行脚本或查看是否可以识别时,找不到命令。 还尝试了: 问题答案: Flask 0.10没有flask命令,它是在0.11中添加的。如果具有运行你的应用程序的技巧,例如使用Flask-Script,那么你要查找的命令是: 如果无法升级到0.11,则可以安装Flask-CLI以在0.10中获取命令。

  • 问题内容: 以下是我运行时遇到的错误: 问题答案: 在没有空格的路径中创建您的virtualenv环境。这就是为什么它发生的原因: 创建环境时,它会建立一个目录。在该目录中是与环境有关的所有可执行文件。有些是脚本。如您所知,hashbang用来告诉系统使用什么解释程序来运行脚本。您可能经常在脚本顶部看到此信息: 如果脚本位于,则告诉系统运行以下命令来执行脚本: 就您而言,virtualenv正在创

  • 本文向大家介绍python 安装virtualenv和virtualenvwrapper的方法,包括了python 安装virtualenv和virtualenvwrapper的方法的使用技巧和注意事项,需要的朋友参考一下 1. 首先介绍pip常用命令 pip安装命令: pip install package_name pip升级命令:pip install –ungrage package_na