2017-07-01 98 views
0
# 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的前缀选项不起作用

easy_install命令试图安装在安装路径/usr/lib/python3.6/site-packages/lib/python2.7/site-packages这是无效的。此安装路径是越来越创建,水光easy_install


问:

如何使用easy_install的解决安装路径?

回答

0

1.您是否使用easy_install与Python2一起使用?尝试使用适用于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

+0

提供的链接提供了404未发现 – overexchange

+0

@overexchange,我测试链接,它works.https://计算器。 com/questions/3849762/python-3-easy-install-pip-and-pypi – xiaoyi

+0

命令(wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py)给出404找不到。请求-URI是错误的,我想 – overexchange