什么路径允许我的 Django 应用程序查看所有已安装的模块?

发布于 2025-01-12 02:23:07 字数 3271 浏览 3 评论 0原文

我正在接手一个复杂的项目。 5 位工程师为此工作了多年,但他们都离开了,我正在尝试自己解决这个问题。

我知道他们之前在 Centos8 上运行过这个应用程序,但 Centos8 在 12 月就停产了,所以我设置了一个运行 Redhat8 的新 EC2 实例。

为了解决各种软件的一些权限问题,我以 root 身份运行。

有一个安装脚本,似乎安装了很多软件。如果我这样做:

pip3 list

那么我会看到:

Package              Version
-------------------- -----------
argcomplete          2.0.0
Babel                2.5.1
blueflow             2.7.3
certifi              2021.10.8
cffi                 1.11.5
chardet              3.0.4
click                8.0.4
cloud-init           21.1
clufter              0.77.1
configobj            5.0.6
cryptography         3.2.1
dbus-python          1.2.4
decorator            4.2.1
distlib              0.3.4
ethtool              0.14
file-magic           0.3.0
filelock             3.4.1
gpg                  1.13.1
html5lib             0.999999999
idna                 2.5
importlib-metadata   4.8.3
importlib-resources  5.4.0
iniparse             0.4
Jinja2               2.10.1
jsonpatch            1.21
jsonpointer          1.10
jsonschema           2.6.0
libcomps             0.1.16
lxml                 4.2.3
MarkupSafe           0.23
oauthlib             2.1.0
packaging            21.3
pcs                  0.10.10
perf                 0.1
pexpect              4.3.1
pip                  21.3.1
pipenv               2022.1.8
pipx                 1.0.0
platformdirs         2.4.0
ply                  3.9
prettytable          0.7.2
ptyprocess           0.5.2
pycparser            2.14
pycurl               7.43.0.2
PyGObject            3.28.3
pyinotify            0.9.6
PyJWT                1.6.1
pyOpenSSL            19.0.0
pyparsing            2.1.10
pyserial             3.1.1
PySocks              1.6.8
python-dateutil      2.6.1
python-dmidecode     3.12.2
python-linux-procfs  0.6.3
pytz                 2017.2
pyudev               0.21.0
PyYAML               3.12
requests             2.20.0
rpm                  4.14.3
schedutils           0.6
selinux              2.9
sepolicy             1.1
setools              4.3.0
setuptools           39.2.0
six                  1.11.0
subscription-manager 1.28.21
suds-jurko           0.7.dev0
syspurpose           1.28.21
typing_extensions    4.1.1
urllib3              1.24.2
userpath             1.7.0
virtualenv           20.13.2
virtualenv-clone     0.5.7
webencodings         0.5.1
zipp                 3.6.0                        

按照以前的工程师写的自述文件,然后我会这样做:

pipenv shell

现在如果我这样做:

pip3 list

这就是安装的全部内容:

pip        21.3.1
setuptools 59.6.0
wheel      0.37.1

所以我再次运行安装脚本,似乎安装了很多东西,大部分是我看到“要求已经满足”,然后我再次执行此操作:

pip3 list

但仍然:

pip        21.3.1
setuptools 59.6.0
wheel      0.37.1

不知何故,安装脚本不使用与 pipenv shell 相同的路径。

我看到此警告:

警告:以“root”用户身份运行 pip 可能会导致权限损坏以及与系统包管理器的行为冲突。建议改用虚拟环境: https://pip.pypa .io/warnings/venv

我有几个问题。 pipenv shell不是建立虚拟环境吗?除了 pipenv shell 之外,我还需要做 venv 吗?

另外,即使以root身份运行,有没有办法让所有Python软件使用相同的路径?

我正在寻找运行该软件的最简单方法。这只是为了发展。

I'm taking over a complex project. 5 engineers worked on this for years, but they have all left, and I'm trying to figure it out on my own.

I know they had this app previously running on Centos8, but Centos8 hit EOL in December, so I set up a new EC2 instance running Redhat8.

To get past some permission issues with various software, I'm running as root.

There was an install script that seemed to install a lot of software. If I do:

pip3 list

then I see:

Package              Version
-------------------- -----------
argcomplete          2.0.0
Babel                2.5.1
blueflow             2.7.3
certifi              2021.10.8
cffi                 1.11.5
chardet              3.0.4
click                8.0.4
cloud-init           21.1
clufter              0.77.1
configobj            5.0.6
cryptography         3.2.1
dbus-python          1.2.4
decorator            4.2.1
distlib              0.3.4
ethtool              0.14
file-magic           0.3.0
filelock             3.4.1
gpg                  1.13.1
html5lib             0.999999999
idna                 2.5
importlib-metadata   4.8.3
importlib-resources  5.4.0
iniparse             0.4
Jinja2               2.10.1
jsonpatch            1.21
jsonpointer          1.10
jsonschema           2.6.0
libcomps             0.1.16
lxml                 4.2.3
MarkupSafe           0.23
oauthlib             2.1.0
packaging            21.3
pcs                  0.10.10
perf                 0.1
pexpect              4.3.1
pip                  21.3.1
pipenv               2022.1.8
pipx                 1.0.0
platformdirs         2.4.0
ply                  3.9
prettytable          0.7.2
ptyprocess           0.5.2
pycparser            2.14
pycurl               7.43.0.2
PyGObject            3.28.3
pyinotify            0.9.6
PyJWT                1.6.1
pyOpenSSL            19.0.0
pyparsing            2.1.10
pyserial             3.1.1
PySocks              1.6.8
python-dateutil      2.6.1
python-dmidecode     3.12.2
python-linux-procfs  0.6.3
pytz                 2017.2
pyudev               0.21.0
PyYAML               3.12
requests             2.20.0
rpm                  4.14.3
schedutils           0.6
selinux              2.9
sepolicy             1.1
setools              4.3.0
setuptools           39.2.0
six                  1.11.0
subscription-manager 1.28.21
suds-jurko           0.7.dev0
syspurpose           1.28.21
typing_extensions    4.1.1
urllib3              1.24.2
userpath             1.7.0
virtualenv           20.13.2
virtualenv-clone     0.5.7
webencodings         0.5.1
zipp                 3.6.0                        

Following the README that the previous engineers wrote, I then do:

pipenv shell

Now if I do:

pip3 list

This is all that is installed:

pip        21.3.1
setuptools 59.6.0
wheel      0.37.1

So I run the install script again, a lot seems to get installed, mostly I see "Requirement already satisfied" and then I do this again:

pip3 list

but still:

pip        21.3.1
setuptools 59.6.0
wheel      0.37.1

Somehow the install script doesn't use the same path as pipenv shell.

I see this warning:

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

I've a few questions. Doesn't pipenv shell establish a virtual environment? Is venv something I would need to do in addition to pipenv shell?

Also, even running as root, is there a way I can get all of the Python software to use the same path?

I'm looking for the simplest way to get this software running. This is just for development.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文