我是一个 Ubuntu 新手,一直在尝试安装 python 的 easy_install,这样我在安装 Python 库时就不必处理源文件。
我已经运行了以下命令,它似乎安装了正确的应用程序:
sudo apt-get install python-setuptools
但是,当我运行easy_install sqlalchemy
or时easy_install pysqlite3
,它不起作用。
我收到以下错误消息:
install_dir /usr/local/lib/python2.6/dist-packages/
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python2.6/dist-packages/test-easy-install-1674.pth'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.6/dist-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
http://packages.python.org/distribute/easy_install.html
Please make the appropriate changes for your system and try again.
帮助!
亚伯拉罕
答案很简单,运行
sudo easy_install
。但是,如果出于某种原因您不想这样做,也可以在您的主目录中安装 Python 包。该过程在本文中进行了详细描述,其中涉及修改 PYTHONPATH 环境变量。