简体   繁体   English

pip 安装在 usr/lib/python3.6/site-packages 而不是 ubuntu 服务器上的 virtualenv

[英]pip installing in usr/lib/python3.6/site-packages instead of virtualenv on ubuntu server

I'm having a problem when installing packages on my virtualenv.It all started when I upgraded my pip to the latest version.我在我的 virtualenv 上安装软件包时遇到问题。这一切都是在我将 pip 升级到最新版本时开始的。 I tried to revert my pip version to where I find it stable.我试图将我的 pip 版本恢复到我认为稳定的位置。 When I try to install, for example, django-tables2, it says:例如,当我尝试安装 django-tables2 时,它说:

Requirement already satisfied: django-tables2 in /usr/lib/python3.6/site-packages (2.3.1)
Requirement already satisfied: Django>=1.11 in /usr/local/lib/python3.6/dist-packages (from django-tables2) (2.2.4)
Requirement already satisfied: pytz in /usr/local/lib/python3.6/dist-packages (from Django>=1.11->django-tables2) (2019.2)
Requirement already satisfied: sqlparse in /usr/local/lib/python3.6/dist-packages (from Django>=1.11->django-tables2) (0.3.0)
WARNING: You are using pip version 19.3.1; however, version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

But when I check my folder in my virtualenv, it doesn't show there.但是当我在我的 virtualenv 中检查我的文件夹时,它并没有显示在那里。 I tried some commands like which pip and which pip3 and it says this:我尝试了一些命令,例如which pipwhich pip3 ,它说:

(unidaenv) root@UnidaWebApplication:/home/unidaweb/unidaproject# which pip
/home/unidaweb/unidaproject/unidaenv/bin/pip
(unidaenv) root@UnidaWebApplication:/home/unidaweb/unidaproject# which pip3
/home/unidaweb/unidaproject/unidaenv/bin/pip3
(unidaenv) root@UnidaWebApplication:/home/unidaweb/unidaproject#

I also tried pip list but I can't find the package that I installed to my virtualenv.我还尝试pip list ,但找不到安装到我的 virtualenv 的 package。

I'm getting a bad gateway error when I try to add it on my settings.py , I don't really know how to fix this but when I'm in the version of pip that I know was stable running my project, I don't get this error and I can install any package that I needed to my project.当我尝试将它添加到我的settings.py时,我遇到了一个bad gateway error ,我真的不知道如何解决这个问题,但是当我使用我知道运行我的项目稳定的 pip 版本时,我不要出现此错误,我可以安装我的项目所需的任何 package。 Any help would be much appreciated.任何帮助将非常感激。 I'm stuck on this for about a week, hoping that someone could help me with this issue.我坚持了大约一个星期,希望有人可以帮助我解决这个问题。

virtualenvs can break occasionally especially if the somebody updated the python executable the virtualenv was based or some packages / shared libraries of it. virtualenvs 偶尔会中断,特别是如果有人更新了 virtualenv 所基于的 python 可执行文件或它的一些包/共享库。

I'd suggest to try out with a new virtualenv.我建议尝试使用新的 virtualenv。 (delete the broken one and replace it) (删除损坏的并替换它)

Further.更远。

for debugging I suggest to type following two commands: type -a python and type -a pip为了调试,我建议输入以下两个命令: type -a pythontype -a pip

In case your search path has some hidden surprises it could be safer to call python -m pip instead of python though in a properly setup virtualenv it shouldn't make a difference.如果您的搜索路径有一些隐藏的惊喜,调用python -m pip而不是python可能会更安全,尽管在正确设置的 virtualenv 中它不应该有所作为。

暂无
暂无

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

相关问题 我不小心删除了我的/usr/lib/python3.6/site-packages/* - I accidentally remove my /usr/lib/python3.6/site-packages/* Django如何在此文件夹“ /usr/local/lib/python3.6/site-packages”下找到Bootstrap文件? - How did Django find Bootstrap files under this folder “/usr/local/lib/python3.6/site-packages”? pip 安装在全局站点包中而不是 virtualenv - pip installing in global site-packages instead of virtualenv 在 Apache 中的 mod_wsgi 中运行 Python 看不到 /usr/local/lib64/python3.6/site-packages 中的 Python 模块 - Running Python in mod_wsgi in Apache Cannot See Python Modules in /usr/local/lib64/python3.6/site-packages 使用 webargs 时,flassger 在 lib/python3.6/site-packages/webargs 中寻找模板 - While using webargs flassger is looking for templates in lib/python3.6/site-packages/webargs 使用张量流时出现ImportError:dlopen(/usr/local/lib/python3.6/site-packages/cv2/cv2.cpython-36m-darwin.so,2) - getting ImportError: dlopen(/usr/local/lib/python3.6/site-packages/cv2/cv2.cpython-36m-darwin.so, 2) when working with tensor flow mod_wsgi错误:ImportError:dlopen(/usr/local/lib/python3.6/site-packages/cv2.so,2):找不到符号:_iconv - mod_wsgi Error: ImportError: dlopen(/usr/local/lib/python3.6/site-packages/cv2.so, 2): Symbol not found: _iconv 如何在Linux下的/usr/local/lib/python2.7/site-packages下安装Pip - how to Install Pip under /usr/local/lib/python2.7/site-packages in Linux Ubuntu上的Virtualenv没有站点包 - Virtualenv on Ubuntu with no site-packages 在Python中安装软件包-Pip / cmd与将文件放入Lib / site-packages - Installing Packages in Python - Pip/cmd vs Putting File in Lib/site-packages
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM