TEST FAILED: /home/mona/.local/lib/python3.8/site-packages/不



我正在使用Python虚拟环境从Git Repo安装一个包。当我使用它的setup.py文件时,我得到以下错误。我该怎么修理它?

mona@goku:~/research/code/IP-Net/src/lib/models/networks/py_utils/_cpools$ python setup.py install --user
running install
Checking .pth file support in /home/mona/.local/lib/python3.8/site-packages/
/home/mona/venv/ipnet/bin/python3 -E -c pass
TEST FAILED: /home/mona/.local/lib/python3.8/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH
You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/home/mona/.local/lib/python3.8/site-packages/
and your PYTHONPATH environment variable currently contains:
'~/venv/ipnet/lib/python3.8/site-packages'
Here are some of your options for correcting the problem:
* You can choose a different installation directory, i.e., one that is
on PYTHONPATH or supports .pth files
* You can add the installation directory to the PYTHONPATH environment
variable.  (It must then also be on PYTHONPATH whenever you run
Python and want to use the package(s) you are installing.)
* You can set up the installation directory to support ".pth" files by
using one of the approaches described here:
https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations

Please make the appropriate changes to your system and try again.

我:

$ pip freeze
numpy==1.20.0
torch==1.7.1
typing-extensions==3.7.4.3
$ echo $PYTHONPATH
~/venv/ipnet/lib/python3.8/site-packages

$ ls ~/venv/ipnet/lib/python3.8/site-packages
total 152K
drwxrwxr-x  3 mona mona 4.0K Feb  2 19:34 ..
-rw-rw-r--  1 mona mona  126 Feb  2 19:34 easy_install.py
drwxrwxr-x  6 mona mona 4.0K Feb  2 19:34 setuptools
drwxrwxr-x  2 mona mona 4.0K Feb  2 19:34 setuptools-44.0.0.dist-info
drwxrwxr-x  2 mona mona 4.0K Feb  2 19:34 pip-20.0.2.dist-info
drwxrwxr-x  5 mona mona 4.0K Feb  2 19:34 pip
drwxrwxr-x  2 mona mona 4.0K Feb  2 19:34 pkg_resources-0.0.0.dist-info
drwxrwxr-x  5 mona mona 4.0K Feb  2 19:34 pkg_resources
-rw-rw-r--  1 mona mona  82K Feb  2 19:42 typing_extensions.py
drwxrwxr-x  2 mona mona 4.0K Feb  2 19:42 typing_extensions-3.7.4.3.dist-info
drwxrwxr-x  2 mona mona 4.0K Feb  2 19:42 __pycache__
drwxrwxr-x 18 mona mona 4.0K Feb  2 19:42 numpy
drwxrwxr-x  2 mona mona 4.0K Feb  2 19:42 numpy.libs
drwxrwxr-x  2 mona mona 4.0K Feb  2 19:42 numpy-1.20.0.dist-info
drwxrwxr-x 29 mona mona 4.0K Feb  2 19:42 torch
drwxrwxr-x 11 mona mona 4.0K Feb  2 19:42 caffe2
drwxrwxr-x 16 mona mona 4.0K Feb  2 19:42 .
drwxrwxr-x  2 mona mona 4.0K Feb  2 19:42 torch-1.7.1.dist-info

代码库位于:https://github.com/vaesl/IP-Net

在我的~/中有以下内容。我已经有消息来源了。它属于我为这个git仓库创建的Python Virt环境:

export PYTHONPATH="~/venv/ipnet/lib/python3.8/site-packages"

根据用户metatoaster的建议,我做了以下操作:

  1. 注释了我添加到~/中的这一行。Bashrc和来源:

    #export PYTHONPATH="~/venv/ipnet/lib/python3.8/site-packages"

  2. 删除--user标志:

    python setup.py install

相关内容

最新更新