无法将Django Python项目推送到Heroku。

14 浏览
0 Comments

无法将Django Python项目推送到Heroku。

我正在尝试运行pip install以安装MySQL-python包,但是我遇到了一个ImportError错误。

Jans-MacBook-Pro:~ jan$ /Library/Frameworks/Python.framework/Versions/3.3/bin/pip-3.3 install MySQL-python
Downloading/unpacking MySQL-python
  Running setup.py egg_info for package MySQL-python
    Traceback (most recent call last):
      File "", line 16, in 
      File "/var/folders/lf/myf7bjr57_jg7_5c4014bh640000gn/T/pip-build/MySQL-python/setup.py", line 14, in 
        from setup_posix import get_config
      File "./setup_posix.py", line 2, in 
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
  File "", line 16, in 
  File "/var/folders/lf/myf7bjr57_jg7_5c4014bh640000gn/T/pip-build/MySQL-python/setup.py", line 14, in 
    from setup_posix import get_config
  File "./setup_posix.py", line 2, in 
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /var/folders/lf/myf7bjr57_jg7_5c4014bh640000gn/T/pip-build/MySQL-python
Storing complete log in /Users/jan/.pip/pip.log
Jans-MacBook-Pro:~ jan$ 

有什么想法吗?

admin 更改状态以发布 2023年5月20日
0
0 Comments

在Python 3中,ConfigParser已被重命名为configparser以符合PEP 8规范。看起来您正在安装的包不支持Python 3。

0
0 Comments

你可以使用mysqlclient包作为MySQL-python的替代品。它是MySQL-python的派生版本,增加了对Python 3的支持。

我运气好,只需在python3.4的虚拟环境中输入

pip install mysqlclient

之后

sudo apt-get install python3-dev libmysqlclient-dev

这显然是特定于ubuntu/debian的,但我只是想分享我的成功 🙂

0