简体   繁体   English

模块无法在不同的python版本上运行

[英]Modules not Working across different python versions

I have two different python programs. 我有两个不同的python程序。 One of the program uses the python BeautifulSoup module, the other uses the MySQLdb module. 该程序之一使用python BeautifulSoup模块,另一个使用MySQLdb模块。 When I run the python files individually, I have no problem and the program run fine and give me the desired output. 当我分别运行python文件时,我没有问题,程序可以正常运行,并提供所需的输出。 However I need to combine the two programs so to achieve my ultimate goal. 但是,我需要将这两个程序结合起来才能实现我的最终目标。 However the Beautiful soup module only runs if I open it in python 2.7.3 and the MySQLdb runs only on the python 2.7.4 (64bit) version. 但是,仅当我在python 2.7.3打开它时,Beautiful汤模块才运行,而MySQLdb仅在python 2.7.4 (64bit)版本上运行。 I installed both the modules exactly the way it was mentioned in the docs. 我完全按照文档中提到的方式安装了两个模块。 Any help will be much appreciated. 任何帮助都感激不尽。

If you have 2 versions of python installed on your system, then you've somehow installed one library in each of them. 如果您的系统上安装了2个版本的python,那么您就应该在每个版本中都安装了一个库。

You either need to install both libraries in both versions of python (which 2 seperate versions of pip can do), or need to setup your PYTHONPATH environment variable to allow loading of modules from additional paths (like the site-packages folder of the python 2.7.4 (64bit) installation from the python 2.7.3 executable). 您可能需要在两个版本的python中都安装两个库(pip的两个独立版本可以做到),或者需要设置PYTHONPATH环境变量以允许从其他路径加载模块(例如python 2.7.4 (64bit)的site-packages文件夹) python 2.7.4 (64bit)python 2.7.3可执行文件安装)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM