简体   繁体   English

指向要安装到指定站点包位置的python模块

[英]Pointing python modules to install to a specified site-packages location

I am having an issue when it comes to installing python3.3 modules. 我在安装python3.3模块时遇到问题。 The current modules are installing to /usr/lib64/python3.3/site-packages but they need to be installed to /usr/lib/python3.3/site-packages. 当前模块正在安装到/usr/lib64/python3.3/site-packages,但是需要将它们安装到/usr/lib/python3.3/site-packages。 Is there a way to point the installation to put the modules in the appropriate location? 有没有办法指出安装位置,将模块放置在适当的位置?

I am using CentOS 6.6 我正在使用CentOS 6.6

While you could specify a prefix directory to tell pip to install into a specific place: 虽然您可以指定前缀目录来告诉pip安装到特定位置:

pip install --install-option="--prefix=/usr/lib/python3.3/site-packages/" my_module

I would instead heavily recommend learning about and using virtual environments to give you greater control of your Python programming environment. 相反,我强烈建议您学习和使用虚拟环境,以更好地控制Python编程环境。

The creation and activation of a virtual environment looks like this: 虚拟环境的创建和激活如下所示:

pyvenv-3.4 my_new_environment
source my_new_environment/bin/activate
pip install my_module

which will make my_module install reliably inside of my_new_environment . 这将使my_module可靠地安装在my_new_environment内部。

Whenever you want to "activate" this environment, you simply source the activate script to tell the Python interpreter where to find its libraries! 每当你想“激活”这样的环境中,您只需sourceactivate脚本告诉Python解释器在哪里可以找到它的库!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python中的站点包 - site-packages in Python 如何在Linux下的/usr/local/lib/python2.7/site-packages下安装Pip - how to Install Pip under /usr/local/lib/python2.7/site-packages in Linux 如何在不同目录中从站点包导入模块? - How to import modules from site-packages when in a different directory? Linux Fedora virtualenv网站程序包的位置不正确 - Linux Fedora virtualenv site-packages incorrect location python:lib / site-packages / site.py和lib / site.py之间的相互作用 - python: Interplay between lib/site-packages/site.py and lib/site.py 在Ubuntu 12.04中安装OpenCV for Python。 dist-packages或site-packages中没有模块? - Installing OpenCV for Python in Ubuntu 12.04. No module present in dist-packages or site-packages? 在Linux上安装cx_Oracle时出现问题-导入仅可从Site-Packages目录中进行 - Issue installing cx_Oracle on Linux - Import only works from Site-Packages Directory OSError:[Errno 30] 只读文件系统:英特尔开发云上的“/glob/intel-python/versions/2018u2/intelpython3/lib/python3.6/site-packages/docs” - OSError: [Errno 30] Read-only file system: '/glob/intel-python/versions/2018u2/intelpython3/lib/python3.6/site-packages/docs' on intel dev cloud python 脚本检查和安装包 - python script to check and install packages 无法在Linux上安装Python软件包 - Unable to Install Python Packages on Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM