easy_install前缀选项不起作用

时间:2017-07-01 07:50:28

标签: python django python-3.x easy-install

# echo $PYTHONPATH
 /usr/lib/python3.6/site-packages
# whoami
 root
# easy_install --prefix=/usr/lib/python3.6/site-packages django==1.9
 TEST FAILED: /usr/lib/python3.6/site-packages/lib/python2.7/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:

    /usr/lib/python3.6/site-packages/lib/python2.7/site-packages

 and your PYTHONPATH environment variable currently contains:

    '/usr/lib/python3.6/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://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

 Please make the appropriate changes for your system and try again.
# ls /usr/lib/python3.6/site-packages/lib/python2.7/site-packages
#

阅读answer后,我无法在文件系统中找到.pydistutils.cfg个文件

easy_install命令尝试在无效的安装路径/usr/lib/python3.6/site-packages/lib/python2.7/site-packages中安装。在easy_install

中创建此安装路径

问题:

如何使用easy_install解析安装路径?

1 个答案:

答案 0 :(得分:0)

1.您使用的是与Python2兼容的easy_install吗?尝试使用适用于Python3的easy_install。

请看this

2. --prefix设置安装前缀。 当您使用easy_install --prefix=/usr/lib/python3.6/site-packages时, dir是:

'/usr/lib/python3.6/site-packages/' + 'lib/python2.7/site-packages'

也许你应该使用--install-dir