【问题标题】:easy_install not installing on the right path?easy_install 没有安装在正确的路径上?
【发布时间】:2014-02-07 17:10:45
【问题描述】:

所以我从 source easy install-3.3 获得了 python3.3.2,我正试图让它们正常工作,但我在其中一台服务器上遇到了问题。在 Ubuntu 中,我只是这样做:

# Install python 3.3.2
cd /tmp/
wget http://www.python.org/ftp/python/3.3.2/Python-3.3.2.tar.bz2
tar xvf Python-3.3.2.tar.bz2
cd Python-3.3.2/
./configure --prefix=/usr/
make
make test
sudo make install

要让 python 工作......这很好,那么:

# Install easy_install for python 3.3.2
cd /tmp/
wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
tar xzvf distribute-0.6.49.tar.gz
cd distribute-0.6.49
sudo python3 setup.py build
sudo python3 setup.py install

然后我可以在输出中看到一些奇怪的东西:

...

Extracting distribute-0.6.49-py3.3.egg to /usr/bin/lib/python3.3/site-packages
distribute 0.6.49 is already the active version in easy-install.pth
Installing easy_install script to /usr/bin/bin
Installing easy_install-3.3 script to /usr/bin/bin

...

为什么easy_install 被放置在/usr/bin/bin???? WTH??

另外,我用 easy_install 安装的所有东西都放在那里:

sudo easy_install-3.3 gunicorn
Searching for gunicorn
Best match: gunicorn 18.0
Processing gunicorn-18.0-py3.3.egg
gunicorn 18.0 is already the active version in easy-install.pth
Installing gunicorn_django script to /usr/bin/bin
Installing gunicorn script to /usr/bin/bin
Installing gunicorn_paster script to /usr/bin/bin

Using /usr/bin/lib/python3.3/site-packages/gunicorn-18.0-py3.3.egg
Processing dependencies for gunicorn
Finished processing dependencies for gunicorn

虽然:

which python3which easy_install-3.3 都按预期指向 /usr/bin

当然所有的二进制文件都在那里,但在 PATH 上无法访问它们......而且我不想编辑我的 PATH 环境变量......关于发生了什么的任何想法??

【问题讨论】:

  • 请问which python3好吗?
  • 我在 /usr/bin/python3 符合预期

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


【解决方案1】:

我完全破坏了我的 python 安装!现在它正在工作。我不知道发生了什么,但 stackoverflow 用户关心的是首先解决的问题......这就是我所做的:

  1. 清除 python3 的每一条踪迹...小心这些命令,它们会炸毁你的 PYTHON3 安装。

    sudo apt-get remove python3
    sudo apt-get remove python3.2*
    sudo apt-get remove python3.3*
    sudo apt-get remove python3.4*
    sudo apt-get remove python-sphinx
    sudo apt-get autoremove
    sudo rm -rf /usr/bin/bin/
    sudo rm -rf /usr/lib/python3*
    sudo rm /usr/bin/python3*
    sudo reboot
    
  2. 重新安装依赖以构建python

    sudo apt-get build-dep -y python3 python-setuptools

  3. 我安装了 3.3.3,因为 3.3.2 给我带来了一些测试问题。

    cd /tmp/
    wget http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tar.bz2
    tar xvf Python-3.3.3.tar.bz2
    cd Python-3.3.3/
    ./configure --prefix=/usr/
    make
    make test
    sudo make install
    python3 --version
    
  4. 现在轻松安装!!!

    cd /tmp/
    wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
    tar xzvf distribute-0.6.49.tar.gz
    cd distribute-0.6.49
    sudo python3 setup.py build
    sudo python3 setup.py install
    
  5. 修复一些权限问题

    sudo chmod +r /usr/lib/python3.3/site-packages/python_dateutil-*-py3.3.egg/EGG-INFO/top_level.txt
    sudo chmod +r /usr/lib/python3.3/site-packages/python3_digest-1.8b4-py3.3.egg/EGG-INFO/top_level.txt
    mkdir -p $HOME/.config/ipython
    sudo chown -R $USER:$USER $HOME/.config/ipython
    sudo chmod g+w $HOME/.config/ipython
    sudo ln -sf /usr/bin/ipython3 /usr/bin/ipython  # this is more for me... maybe you don't want this one... it will open ipython3 on `ipython` command.
    
  6. 试试吧!

    sudo easy_install-3.3 ipython gunicorn
    

现在一切都井井有条!

Adding gunicorn 18.0 to easy-install.pth file
Installing gunicorn script to /usr/bin
Installing gunicorn_django script to /usr/bin
Installing gunicorn_paster script to /usr/bin

检查 /usr/bin !!!!你不就是想舔吗!?

哈!

【讨论】:

    猜你喜欢
    • 2017-05-15
    • 2012-01-18
    • 2013-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多