TEST FAILED: /home/mona/.local/lib/python3.8/site-packages/ does NOT support .pth files error: bad install directory or PYTHONPATH
TEST FAILED: /home/mona/.local/lib/python3.8/site-packages/ does NOT support .pth files error: bad install directory or PYTHONPATH
我正在使用 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
我的 ~/.bashrc 中有以下内容并且已经有它的源代码。它属于我为此 git 仓库制作的 Python 虚拟环境:
export PYTHONPATH="~/venv/ipnet/lib/python3.8/site-packages"
根据用户 metatoaster
的建议,我做了以下操作:
评论了我添加到 ~/.bashrc 并获取它的这一行:
#export PYTHONPATH="~/venv/ipnet/lib/python3.8/site-packages"
删除了此处的 --user
标志:
python setup.py install
我正在使用 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
我的 ~/.bashrc 中有以下内容并且已经有它的源代码。它属于我为此 git 仓库制作的 Python 虚拟环境:
export PYTHONPATH="~/venv/ipnet/lib/python3.8/site-packages"
根据用户 metatoaster
的建议,我做了以下操作:
评论了我添加到 ~/.bashrc 并获取它的这一行:
#export PYTHONPATH="~/venv/ipnet/lib/python3.8/site-packages"
删除了此处的
--user
标志:python setup.py install