2017-07-01 95 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